K = int(input())
a = 7
flag = True

for i in range(K):
    if a % K == 0:
        print(i+1)
        flag = False
        break
    a = (a * 10 + 7) % K

if flag:
    print(-1) K = int(input()) K int(input()) int input() input a = 7 a 7 flag = True flag True for i in range(K):
    if a % K == 0:
        print(i+1)
        flag = False
        break
    a = (a * 10 + 7) % K i range(K) range K if a % K == 0:
        print(i+1)
        flag = False
        break
     a % K == 0 a % K a K 0 print(i+1) print i+1 i 1 flag = False flag False break a = (a * 10 + 7) % K a (a * 10 + 7) % K a * 10 + 7 a * 10 a 10 7 K if flag:
    print(-1) flag print(-1) print -1 flag = False False flag a = (a * 10 + 7) % K (a * 10 + 7) % K a K = int(input()) int(input()) K flag = True True flag a = 7 7 a
K = int(input())
a = 7
flag = True

for i in range(K):
    if a % K == 0:
        print(i+1)
        flag = False
        break
    a = (a * 10 + 7) % K

if flag:
    print(-1)
