407 - 1 + 2 + 3 + . . . + n = k
1 + 2 + 3 + . . . + n = k
Time Limit: 1 sec
The Problem
Given the following formula, in order to obtain a given k, you need to find the value of n.
1 + 2 + 3 + ... + n = k
For example:
Given k = 15, the expression to be used will be
1 + 2 + 3 + 4 + 5 = 15 Here, n = 5
The Input
Input file contain a series of line, each line contain one integers k (0< =k <=1000405). Input is terminated by EOF.
The Output
For each line of input, your program should print the minimal possible n (1<=n) to obtain k with the above formula.
Sample Input
15
5050
6
Sample Output
5
100
3
Problem Setter: Shahin ShamS