Problems
Mean Median Problem
Mean Median Problem
The mean of three integers a, b and c is (a + b + c) / 3. The median of three integers is the one that would be in the middle if they are sorted in non-decreasing order.
Given two integers a and b, return the minimum possible integer c such that the mean and the median of a, b and c are equal.
Input
Each test case is given in a single line that contains two integers a and b (1 ≤ a ≤ b ≤ 109
). The last test case is followed by a line containing two zeros.
Output
For each test case output one line containing the minimum possible integer c such that the mean and the median of a, b and c are equal.
Input example #1
1 2 6 10 1 1000000000 0 0
Output example #1
0 2 -999999998