favorite We need a little bit of your help to keep things running, click on this banner to learn more

The presents to the 8th of March

The presents to the 8th of March

Boys decided to prepare presents for girls on a holiday of 8th of March. When they were preparing presents, they quickly put there a congratulation postcard and a soft toy. But when they began to put mandarins, they came face to face with such trouble. At first they wanted to put m mandarins in every package (and in other packages - apples), but they couldn't do it because in one package were m - 1 mandarins. Then they decided to put m - 1 mandarins, but m - 2 mandarins left. Then they decided to put m - 2 mandarins, but m - 3 mandarins left, and so on. When they decide to put 2 mandarins, then 1 mandarin left. How many mandarins did the boys buy?



The number of mandarins m (1 < m1000), that the boys wanted to put initially into the presents.


The minimum possible number of mandarins, that the boys bought as a gift for the girls.

Time limit 1 second
Memory limit 128 MiB
Input example #1
Output example #1