#Lutece1308. Banana Watch

Banana Watch

Migrated from Lutece 1308 Banana Watch

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

As a famous technology company, Banana Inc. invents Banana Watch, redefining the watch.

While a normal watch has 1212 indexes and two or three moving hands, a Banana Watch has nn indexes and a moving hand.

The moving hand is at 00 initially, and in 1st1^{st} second, it turns 11 index clockwise; in 2nd2^{nd} second, it turns 22 indexes clockwise; ... ; in ithi^{th} second, it turns ii indexes clockwise. When it moves back to 00 exactly, one minute passes (Yes, Banana Inc. also redefines the minute).

How many seconds in the first minute?

Input

One integer nn.

3n1063\leq n\leq 10^6

Output

Print the number of seconds in the first minute.

Samples

3
2
5
4

Note

If n=5n=5, in 1st1^{st} second, the hand moves to 11; in 2nd2^{nd} second, the hand moves to 33; in 3rd3^{rd} second, the hand moves to 11; in 4th4^{th} second, the hand moves to 00. So the answer for n=5n=5 is 44.

Resources

The 14th UESTC Programming Contest Final