K=int(input())
num=7
ans=-1
for n in range(pow(10,7)):
    if num%K==0:
        ans=n+1
        break
    shou=num//K
    num-=K*shou
    num=int(str(num)+'7')
print(ans) K=int(input()) K int(input()) int input() input num=7 num 7 ans=-1 ans -1 for n in range(pow(10,7)):
    if num%K==0:
        ans=n+1
        break
    shou=num//K
    num-=K*shou
    num=int(str(num)+'7') n range(pow(10,7)) range pow(10,7) pow 10 7 if num%K==0:
        ans=n+1
        break
     num%K==0 num%K num K 0 ans=n+1 ans n+1 n 1 break shou=num//K shou num//K num K num-=K*shou num K*shou K shou num=int(str(num)+'7') num int(str(num)+'7') int str(num)+'7' str(num) str num '7' print(ans) print ans shou=num//K num//K shou num=7 7 num ans=-1 -1 ans num-=K*shou K*shou num num=int(str(num)+'7') int(str(num)+'7') num ans=n+1 n+1 ans K=int(input()) int(input()) K
K=int(input())
num=7
ans=-1
for n in range(pow(10,7)):
    if num%K==0:
        ans=n+1
        break
    shou=num//K
    num-=K*shou
    num=int(str(num)+'7')
print(ans)
