k=int(input())
A=[0]*k
f=0
for i in range(k):
  if i==0:
    A[i]=7%k
  else:
    A[i]=(10*A[i-1]+7)%k
  
  if A[i]==0:
    f=1
    print(i+1)
    exit()
if not f:
  print(-1) k=int(input()) k int(input()) int input() input A=[0]*k A [0]*k [0] 0 k f=0 f 0 for i in range(k):
  if i==0:
    A[i]=7%k
  else:
    A[i]=(10*A[i-1]+7)%k
  
  if A[i]==0:
    f=1
    print(i+1)
    exit() i range(k) range k if i==0:
    A[i]=7%k
  else:
    A[i]=(10*A[i-1]+7)%k
  
   i==0 i 0 A[i]=7%k A[i] A i 7%k 7 k 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 if A[i]==0:
    f=1
    print(i+1)
    exit() A[i]==0 A[i] A i 0 f=1 f 1 print(i+1) print i+1 i 1 exit() exit if not f:
  print(-1) not f f print(-1) print -1 A=[0]*k [0]*k A k=int(input()) int(input()) k f=0 0 f f=1 1 f
k=int(input())
A=[0]*k
f=0
for i in range(k):
  if i==0:
    A[i]=7%k
  else:
    A[i]=(10*A[i-1]+7)%k
  
  if A[i]==0:
    f=1
    print(i+1)
    exit()
if not f:
  print(-1)