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