import cp.
main =>
N*N mod 1000000 #= 269696, % ends with "269696"
N #> 0, % positive integer
solve($[min(N)],[N]), % minimize N
println(n=N).