k = int(input())

flag = 0
temp = 7
for i in range(k):
    if(temp % k == 0):
        flag = 1
        break
    else:
        temp = temp % k
        temp = temp * 10 % k
        temp = temp + 7

if (flag == 0):
    print("-1")
else:
    print(i+1) k = int(input()) k int(input()) int input() input flag = 0 flag 0 temp = 7 temp 7 for i in range(k):
    if(temp % k == 0):
        flag = 1
        break
    else:
        temp = temp % k
        temp = temp * 10 % k
        temp = temp + 7 i range(k) range k if(temp % k == 0):
        flag = 1
        break
    else:
        temp = temp % k
        temp = temp * 10 % k
        temp = temp + 7 temp % k == 0 temp % k temp k 0 flag = 1 flag 1 break temp = temp % k temp temp % k temp k temp = temp * 10 % k temp temp * 10 % k temp * 10 temp 10 k temp = temp + 7 temp temp + 7 temp 7 if (flag == 0):
    print("-1")
else:
    print(i+1) flag == 0 flag 0 print("-1") print "-1" print(i+1) print i+1 i 1 flag = 1 1 flag temp = temp * 10 % k temp * 10 % k temp flag = 0 0 flag temp = temp + 7 temp + 7 temp k = int(input()) int(input()) k temp = temp % k temp % k temp temp = 7 7 temp
k = int(input())

flag = 0
temp = 7
for i in range(k):
    if(temp % k == 0):
        flag = 1
        break
    else:
        temp = temp % k
        temp = temp * 10 % k
        temp = temp + 7

if (flag == 0):
    print("-1")
else:
    print(i+1)