# Series of Pi

We all know the importance of pi or π; in different fields of mathematics. Pi is a constant defined as the ratio of the circumference and diameter of the same circle. Mathematicians have always remained interested in finding the value of pi as accurately as they can. For this purpose many series of pi has been invented. The proof or derivation methods of some of these series are not at all difficult. For example from the relation ship π = [tan−1x]1 = 4 001+x2 ∫ 1 1 dx, we can derive the formula: π = 4 − 4 + 4 − 4 + 4 − 4 . . . to ∞ 1 3 5 7 9 11 The problem with this formula is that it converges very slowly. For example to find the value of pi correctly up to five digits after the decimal point you have to add the first 130658 term of the series above, which is not an healthy option at all. Also due to the precision limitation of floating-point numbers, a series whose terms change sign alternately succumbs to precision error severely. A better series can be developed from the relationship π = [sin−1x]0.5. First few terms of the series will be something like, π=6+6+18+ 30 +...to∞. 2 48 1280 14336 This series converges very fast. For example to find the value of pi correctly up to five digits after the decimal point you have to add only first 7-th term of this series. In practical field it is impossible to sum a series up to infinite terms so generally a series is summed until the term to be added goes below a certain value. This certain value can be called the threshold value. Given the threshold value your job is to find out how many terms of the second series you need to add before the term reaches below the threshold value. Input The input file contains less than 1000 lines of input. Each line contains an integer n (1 ≤ n ≤ 600000). Input is terminated by a case where the value of n is negative. This line should not be processed. Output For each line of input you should produce one line of output. This line contains an integer which indicates how many terms are added before a term reaches below the value 10−n. Sample Input 1 5 100000 -1 Sample Output 2 7 166084 60