1219. Snake again

Last time,we have done the snake matrix easy,now wo have to do it again,but it is also easy.

Last time,we had snake matrix like “snake matrix one”.Now we have it like picture two.What do we do?Like last time,output the snake matrix like “snake matrix two”? NO! That’s too bother.What we have to do is according to the input N, to find this number’s coordinate x,y,from the “snake matrix one”.finally output the number in “snake matrix two” whose coordinate is x and y.Is it easy?just do it.

输入格式

There are many tests.Each test have a number N in one line.N is not more than 5000.Please Process to end of file.

输出格式

For each case, output a number M in one line.

样例

Input
1
5
10

Output
1
5
7


66 人解决，78 人已尝试。

77 份提交通过，共有 158 份提交。

3.1 EMB 奖励。