Next one in the series

Consider the series 0,0+1,0+1+2,0+1+2+3,0+1+2+3+4,=0,1,3,6,10,0,~ 0 + 1,~ 0 + 1 + 2,~ 0 + 1 + 2 + 3,~ 0 + 1 + 2 + 3 + 4,~ \dots \quad = \quad 0,~ 1,~ 3,~ 6,~ 10,~ \dots Write a program that, for every given natural number nn, prints the first number of the series greater than or equal to nn.

Input

Input consists of a sequence of natural numbers nn.

Output

For every nn, print the first number of the series 0,1,3,6,0, 1, 3, 6, \dots that is greater than or equal to nn.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:03:09.437Z

© Jutge.org, 2006–2026.
https://jutge.org