#!/usr/bin/env python3
def minrep(n):
base = 10 % (9*n)
m = base
c = 1
while m != 1:
m = (m * base) % (9*n)
c += 1
return c
target = 10**6
n = target + (not target%2)
while n%5 == 0 or minrep(n) < target:
n += 2
print(n)