K =  int(input())

a = [0]*1000001
ans = -1
a[1] = 7%K

for i in range(2,K+1):
    a[i] = (10*a[i-1]+7)%K
for i in range(1,K+1):
    if a[i] == 0:
        ans = i
        print(i)
        break
if ans == -1:
    print(-1) K =  int(input()) K int(input()) int input() input a = [0]*1000001 a [0]*1000001 [0] 0 1000001 ans = -1 ans -1 a[1] = 7%K a[1] a 1 7%K 7 K for i in range(2,K+1):
    a[i] = (10*a[i-1]+7)%K i range(2,K+1) range 2 K+1 K 1 a[i] = (10*a[i-1]+7)%K a[i] a i (10*a[i-1]+7)%K 10*a[i-1]+7 10*a[i-1] 10 a[i-1] a i-1 i 1 7 K for i in range(1,K+1):
    if a[i] == 0:
        ans = i
        print(i)
        break i range(1,K+1) range 1 K+1 K 1 if a[i] == 0:
        ans = i
        print(i)
        break a[i] == 0 a[i] a i 0 ans = i ans i print(i) print i break if ans == -1:
    print(-1) ans == -1 ans -1 print(-1) print -1 ans = -1 -1 ans K =  int(input()) int(input()) K ans = i i ans a = [0]*1000001 [0]*1000001 a
K =  int(input())

a = [0]*1000001
ans = -1
a[1] = 7%K

for i in range(2,K+1):
    a[i] = (10*a[i-1]+7)%K
for i in range(1,K+1):
    if a[i] == 0:
        ans = i
        print(i)
        break
if ans == -1:
    print(-1)
