K = int(input())

a=[7 % K]
for i in range(1, K):
  a.append((10*a[i-1] + 7) % K)

flag = False
for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    flag = True
    break
if not flag:
  print(-1) K = int(input()) K int(input()) int input() input a=[7 % K] a [7 % K] 7 % K 7 K for i in range(1, K):
  a.append((10*a[i-1] + 7) % K) i range(1, K) range 1 K a.append((10*a[i-1] + 7) % K) a.append a append (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 flag = False flag False for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    flag = True
    break i range(len(a)) range len(a) len a if a[i] == 0:
    print(i+1)
    flag = True
    break a[i] == 0 a[i] a i 0 print(i+1) print i+1 i 1 flag = True flag True break if not flag:
  print(-1) not flag flag print(-1) print -1 flag = False False flag K = int(input()) int(input()) K a=[7 % K] [7 % K] a flag = True True flag
K = int(input())

a=[7 % K]
for i in range(1, K):
  a.append((10*a[i-1] + 7) % K)

flag = False
for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    flag = True
    break
if not flag:
  print(-1)
