시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 697 327 292 56.699%

문제

2차원 평면의 제 1사분면에 점이 무한개 찍혀있다. 점의 x, y좌표는 모두 양의 정수이다. 오른쪽 그림과 같이 대각선 순서로 점에 자연수를 할당할 수 있다.

각 점에 할당된 숫자는 점 숫자라고 부른다. (x,y)의 점 숫자는 #(x,y)로 나타낸다. 예를 들어, #(1,1) = 1, #(2,1) = 3, #(2,2) = 5, #(4,4) = 25 이다.

두 점을 더하면, 각 좌표를 더한 값이 좌표인 점이된다. 즉, (a,b) + (c,d) = (a+c,b+d)이다. 모든 점 숫자는 점을 유일하게 결정하기 때문에, 두 점 숫자의 덧셈으로도 점 덧셈을 나타낼 수 있다. 예를 들어, (1,1)과 (2,2)를 더하는 것은 1+5로 나타낼 수 있다. (#(1,1)=1, #(2,2) = 5) 또, 그 결과는 13 (#(3,3) = 13)이 된다.

점 숫자로 나타낸 두 점이 입력으로 주어졌을 때, 두 점을 더해, 결과를 점 숫자로 출력하는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있고, 두 점 숫자가 주어진다. 점 숫자는 0보다 크고, 10,000보다 작다.

출력

각 테스트 케이스마다 입력으로 주어진 두 점 숫자의 합을 출력한다. 결과는 10,000보다 클 수도 있다. 

예제 입력 1

2
1 5
3 9

예제 출력 1

13
26
W3sicHJvYmxlbV9pZCI6Ijg4OTEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM4MTAgXHVjMjJiXHVjNzkwIiwiZGVzY3JpcHRpb24iOiI8cD48aW1nIGFsdD1cIlwiIHNyYz1cIlwvdXBsb2FkXC9pbWFnZXNcL2RudW0oMSkucG5nXCIgc3R5bGU9XCJmbG9hdDpyaWdodDsgaGVpZ2h0OjIzM3B4OyB3aWR0aDoyMzlweFwiIFwvPjJcdWNjMjhcdWM2ZDAgXHVkM2M5XHViYTc0XHVjNzU4IF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