K = int(input())
#a1= 7 mod K
#a2= a1*10+7 mod K
#a3= a2*10+7 mod K
a = 0
count = -1
for i in range(K):
    a = (7 + a*10) % K
    if a  == 0:
        count=i+1
        break
print(count) K = int(input()) K int(input()) int input() input a = 0 a 0 count = -1 count -1 for i in range(K):
    a = (7 + a*10) % K
    if a  == 0:
        count=i+1
        break i range(K) range K a = (7 + a*10) % K a (7 + a*10) % K 7 + a*10 7 a*10 a 10 K if a  == 0:
        count=i+1
        break a  == 0 a 0 count=i+1 count i+1 i 1 break print(count) print count K = int(input()) int(input()) K count = -1 -1 count a = 0 0 a a = (7 + a*10) % K (7 + a*10) % K a count=i+1 i+1 count
K = int(input())
#a1= 7 mod K
#a2= a1*10+7 mod K
#a3= a2*10+7 mod K
a = 0
count = -1
for i in range(K):
    a = (7 + a*10) % K
    if a  == 0:
        count=i+1
        break
print(count)