Reach The Point

All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Recently Chef bought a bunch of robotwaiters. And now he needs to know how much to pay for the electricity that robots use for their work. All waiters serve food from the kitchen (which is in the point (0, 0)) and carry it to some table (which is in some point (x, y)) in a shortest way. But this is a beta version of robots and they can only do the next moves: turn right and make a step forward or turn left and make a step forward. Initially they look in direction of Xaxis. Your task is to calculate for each query the number of moves they’ll do to reach corresponding table.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. For each test case there is a sing line containing two spaceseparated integers  x and y.
Output
For each test case, output a single line containing number of moves that robot will make to reach point (x, y)
Constraints
 1 ≤ T ≤ 10^{5}
 10^{9} ≤ x, y ≤ 10^{9}
Example
Input: 2 3 3 3 4 Output: 6 7
Explanation
Example case 1. Sequence of moves would be LRLRLR
Author:  witalij_hq 
Editorial  http://discuss.codechef.com/problems/RETPO 
Tags  july14, maths, simple, witalij_hq 
Date Added:  25042014 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions