k=int(input())
se=0
for i in range(k):
    se=se*10
    se+=7
    i+=1
    if se%k==0:
        print(i)
        exit()
    se%=k
print('-1') k=int(input()) k int(input()) int input() input se=0 se 0 for i in range(k):
    se=se*10
    se+=7
    i+=1
    if se%k==0:
        print(i)
        exit()
    se%=k i range(k) range k se=se*10 se se*10 se 10 se+=7 se 7 i+=1 i 1 if se%k==0:
        print(i)
        exit()
     se%k==0 se%k se k 0 print(i) print i exit() exit se%=k se k print('-1') print '-1' i+=1 1 i se%=k k se se+=7 7 se se=se*10 se*10 se k=int(input()) int(input()) k se=0 0 se
k=int(input())
se=0
for i in range(k):
    se=se*10
    se+=7
    i+=1
    if se%k==0:
        print(i)
        exit()
    se%=k
print('-1')