Square Garden 

The farmer Rick has a square garden of side L meters long, divided in a grid with L2 square modules, each one of side 1 meter long. Rick wants to cultivate N modules of the garden and he knows that the production will be better if the cultivated area receives more water. He uses drip irrigation technology, which is done by means of hoses installed along the perimeter of the cultivated area.


It should be clear that there are different ways to choose the N modules that should be cultivated. The following figure shows two ways to cultivate N = 8 modules in a square garden with side L = 3. The left diagram shows a cultivated surface with a perimeter of length 16; the right one depicts another possibility, with perimeter 12.

\epsfbox{p12520a.eps} \epsfbox{p12520b.eps}


Rick wants to maximize the perimeter of the selected area in order to optimize the production. Then you have been hired to help him determining the largest perimeter that an area of N modules of the garden may attain.

Input 

There are several cases to consider. Each case is described with a line with two integer numbers L and N separated by one blank, indicating the length of the garden's side and the number of modules that must be cultivated, respectively ( 1 $ \leq$ L $ \leq$ 106, 0 $ \leq$ N $ \leq$ L2). Input ends with a line with two `0' values.

Output 

For each case, output a line with the maximum perimeter that can be achieved.

Sample Input 

1 0
1 1
2 3
3 8
0 0

Sample Output 

0
4
8
16