Time limit
1s
Memory limit
1024 MB
For an integer a, write a2 in decimal notation. A positive integer N is called a square-substring-free number if none of those decimal strings appears as a substring of the decimal representation of N.
In increasing order, these numbers begin as 2,3,5,6,7,8,22,23,26,….
Given a positive integer N, find the smallest square-substring-free number that is at least N.
A positive integer N is given.
1≤N≤1018
Print the smallest square-substring-free number that is at least N.