시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 410 360 337 89.628%

문제

세 정수 A, B, C의 평균은 (A+B+C)/3이다. 세 정수의 중앙값은 수의 크기가 증가하는 순서로 정렬했을 때, 가운데 있는 값이다.

두 정수 A와 B가 주어진다. 이 때, A, B, C의 평균과 중앙값을 같게 만드는 가장 작은 정수 C를 찾는 프로그램을 작성하시오.

입력

입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있고, A와 B가 주어진다. (1 ≤ A ≤ B ≤ 109) 입력의 마지막 줄에는 0이 두 개 주어진다. 

출력

각 테스트 케이스에 대한 정답을 한 줄에 하나씩 출력한다.

예제 입력 1

1 2
6 10
1 1000000000
0 0

예제 출력 1

0
2
-999999998
W3sicHJvYmxlbV9pZCI6IjU2OTEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQzYzlcdWFkZTAgXHVjOTExXHVjNTU5XHVhYzEyIFx1YmIzOFx1YzgxYyIsImRlc2NyaXB0aW9uIjoiPHA+XHJcblx0XHVjMTM4IFx1YzgxNVx1YzIxOCBBLCBCLCBDXHVjNzU4IFx1ZDNjOVx1YWRlMFx1Yzc0MCAoQStCK0MpXC8zXHVjNzc0XHViMmU0LiBcdWMxMzggXHVjODE1XHVjMjE4XHVjNzU4IFx1YzkxMVx1YzU1OVx1YWMxMlx1Yzc0MCBcdWMyMThcdWM3NTggXHVkMDZjXHVhZTMwXHVhYzAwIFx1Yzk5ZFx1YWMwMFx1ZDU1OFx1YjI5NCBcdWMyMWNcdWMxMWNcdWI4NWMgXHVjODE1XHViODJjXHVkNTg4XHVjNzQ0IFx1YjU0YywgXHVhYzAwXHVjNmI0XHViMzcwIFx1Yzc4OFx1YjI5NCBcdWFjMTJcdWM3NzRcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlxyXG5cdFx1YjQ1MCBcdWM4MTVcdWMyMTggQVx1YzY0MCBCXHVhYzAwIFx1YzhmY1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