/*

Swimming

时间限制:1000 ms  |  内存限制:65535 KB
难度:1
 
描述
Peipei likes swimming. Strange that he always swims from a coner to the counter corner in
the way bellow(that means Peipei must swim to the other site and back, then go to the other site
corner),  as is  shown in Figure  P1
Figure P1    The pool and the way of swimming
Now the problem comes to you is: what is the least distance peipei has to swim ?
 
输入
There are several test cases, one line for each case. For each line,There are two number of
positive integers of the width and height. Width and Height are between l and 10 000, inclusively.
Input is ended with Width = Height = 0.
输出
Output each least distance in a single line, round the result to the nearest integer, e.g. 1.3
rounds to 1, 1.8 rounds to 2, 123.456 rounds to 123, 123.5 rounds to 124, 124.5 rounds to 125.
样例输入
1 1
1 2
2 1
0 0
样例输出
3
6
4
来源
《国际大学生程序设计竞赛例题解 》
上传者
TC_高金
*/
 1 #include<stdio.h>
 2 #include<math.h>
 3 int main()
 4 {
 5     double w, h;
 6     while( scanf ("%lf%lf", &w, &h) != EOF && w && h )
 7     {
 8         double x, y;
 9         x = w * 2 / 3;
10         y = 2*sqrt(x*x/4.0+h*h) + sqrt( (w/ 3.0) * (w/ 3.0 ) + h*h );
11         printf("%.0lf\n", y);
12     }
13     return 0;
14 }