#C
import sys
k=int(input())
s=0

for i in range(k):
    s=s*10+7
    if s%k!=0:
        s=s%k
    else:
        print(i+1)
        sys.exit()
print(-1) import sys sys k=int(input()) k int(input()) int input() input s=0 s 0 for i in range(k):
    s=s*10+7
    if s%k!=0:
        s=s%k
    else:
        print(i+1)
        sys.exit() i range(k) range k s=s*10+7 s s*10+7 s*10 s 10 7 if s%k!=0:
        s=s%k
    else:
        print(i+1)
        sys.exit() s%k!=0 s%k s k 0 s=s%k s s%k s k print(i+1) print i+1 i 1 sys.exit() sys.exit sys exit print(-1) print -1 s=s*10+7 s*10+7 s k=int(input()) int(input()) k s=s%k s%k s s=0 0 s
#C
import sys
k=int(input())
s=0

for i in range(k):
    s=s*10+7
    if s%k!=0:
        s=s%k
    else:
        print(i+1)
        sys.exit()
print(-1)