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