1492 - sqrt log sin

Time Limit : 2 Second

Memory Limit : 256 MB

Submission: 16

Solved: 6

Description
An evil professor has just assigned you the following problem.



A sequence is defined by the following recurrence:







Determine x1000000.
Input
Input consists of a number of lines, each containing one integer, a value of i, no less than zero and no greater than one million. Input is followed by a single line containing the integer -1. This last line is not a value of i and should not be processed.
Output
For each value of i in the input (but not the final -1), output the corresponding value of xi modulo 1000000.
sample input
0
-1
sample output
1
hint
source
waterloo 3 October, 2009
© 2015 HUST ACMICPC TEAM. All Right Reserved.