Next one in the series P40593


Statement
 

pdf   zip

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.

Public test cases
  • Input

    6
    7
    1
    2
    

    Output

    6
    10
    1
    3
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python