k=int(input())
num=7
i=1
while True:
    if k%2==0 or k%5==0:
        i=-1
        break
    num%=k
    if num==0:
        break
    else:
        num*=10
        num+=7
        i+=1
print(i) k=int(input()) k int(input()) int input() input num=7 num 7 i=1 i 1 while True:
    if k%2==0 or k%5==0:
        i=-1
        break
    num%=k
    if num==0:
        break
    else:
        num*=10
        num+=7
        i+=1 True if k%2==0 or k%5==0:
        i=-1
        break
     k%2==0 or k%5==0 k%2==0 k%2 k 2 0 k%5==0 k%5 k 5 0 i=-1 i -1 break num%=k num k if num==0:
        break
    else:
        num*=10
        num+=7
        i+=1 num==0 num 0 break num*=10 num 10 num+=7 num 7 i+=1 i 1 print(i) print i i=1 1 i num%=k k num num*=10 10 num k=int(input()) int(input()) k num+=7 7 num i=-1 -1 i i+=1 1 i num=7 7 num
k=int(input())
num=7
i=1
while True:
    if k%2==0 or k%5==0:
        i=-1
        break
    num%=k
    if num==0:
        break
    else:
        num*=10
        num+=7
        i+=1
print(i)