2009 Bulgarian Olympiad in Informatics
Consider the positive integers whose squares contain only (and all) the digits . Let's call them "special". For example, is special, because and the square contains only (and all) of . is also special: . and are not special - ( and aren't allowed) and (there's no ).
Consider the sequence of special numbers, in order:
Write a program to find the number in this sequence.
Input Specification
The positive integer , on a single line.
Output Specification
The number in the special sequence (starting from ).
Sample Input
12
Sample Output
20102
Comments