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