Problem J

Opening Doors

 

21th June!! Holidays at last!!

 

That's what everyone in the school thought when the bell rang. It was time to leave the class and go away forever (or until September). Dima was running to the exit when he saw that paper on the wall:

 

Don't forget to unlock all the lockers so that we can clean them in summer.
The principal.

 

Oh, no! Dima forgot to unlock it! So he had to go to the corridor where lockers were. When he got there, all the lockers had been already unlocked. Some of them were open and some of them were closed. Lockers were numbered from 1 to 90 (the number of boys in the school) and he had the last one. So he walked along the long corridor. While he reached his locker, he started to think why some of the doors were open and some closed. Then he invented a method to keep some open and some closed:

 

Once all the lockers were unlocked, the boy with locker number 1 opened all doors. Then the boy with locker number 2 closed the doors multiple of 2. Then the boy with locker number 3 changed the status of all doors multiple of 3 (he opens doors 6,12...and he closes doors 3, 9...)...and until everyone, including Dima, had done so.

 

Now he wants to know whether that was what happened or not. As a first-sight method, he wants to see if the door with the biggest number that is open matches the door with the biggest number that keeps open using his method. That's where he needs your help. He could do it by hand, but he also wants to check it next year (and the number of students may change), so he asked you for a program that simulates it for any number of students.

 

Each line in the input will contain a single number N (1≤N≤10^100), indicating the number of boys in the school (you never know what the number of students will be if Earth population keeps growing...).

 

Input will be terminated by a test case with N=0. That line shouldn't be processed. For each line in the input, write a line with the number of the door with the biggest number that keeps open.

 

Sample Input

Sample Output

1

90

0

1

81

 

Problem author: Carlos M. Casas Cuadrado

Problem submitter: Carlos M. Casas Cuadrado

Problem solution: Carlos M. Casas Cuadrado