NSTEPS - Number Steps


Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2, ... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this pattern has continued.

 

Illustration

 

You are to write a program that reads the coordinates of a point (x, y), and writes the number (if any) that has been written at that point. (x, y) coordinates in the input are in the range 0...10000.

Input

The first line of the input is N, the number of test cases for this problem. In each of the N following lines, there is x, and y representing the coordinates (x, y) of a point.

Output

For each point in the input, write the number written at that point or write No Number if there is none.

Example

Input:
3
4 2
6 6
3 4

Output:
6
12
No Number

hide comments
maju91: 2019-03-28 21:53:08

No loop 0.02s :D

sjd: 2019-02-07 18:14:11

ac in one go!

adarsh313: 2019-01-06 15:31:13

AC in first attempt

yigoli: 2019-01-03 02:06:28

Both N are capital!!! "No Number"

sudesh12345: 2018-12-15 20:51:56

@arrandale
I took all the inputs together and printed their results together, my answer was accepted .
I don't know about other case.

sudesh12345: 2018-12-15 20:49:41

AC in first attempt.
Don't think too much, write the pattern in a paper for 7-8 numbers and then find the logic in it.

arrandale: 2018-12-15 11:24:33

Do we have to take all inputs at a time all together and print their results together or take one input ,print its output then take another input ,print its output and so on.
?

trungams: 2018-12-14 02:51:21

got WA twice bc I did not capitalize the n in 'No Number' :'(

chinmay_sharma: 2018-12-07 11:06:22

i am getting time limit exceed

aashish_a2z: 2018-11-30 16:12:08

Very easy...Just observe the pattern...If someone then u can.....
Both N are capital....!


Added by:Camilo Andrés Varela León
Date:2006-11-25
Time limit:1.159s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Asia - Tehran 2000