K=int(input())
a=7
for i in range(1,K+1):
    if a%K==0:
        print(i)
        exit()
    a=(a*10+7)%K
print(-1) K=int(input()) K int(input()) int input() input a=7 a 7 for i in range(1,K+1):
    if a%K==0:
        print(i)
        exit()
    a=(a*10+7)%K i range(1,K+1) range 1 K+1 K 1 if a%K==0:
        print(i)
        exit()
     a%K==0 a%K a K 0 print(i) print i exit() exit a=(a*10+7)%K a (a*10+7)%K a*10+7 a*10 a 10 7 K print(-1) print -1 K=int(input()) int(input()) K a=(a*10+7)%K (a*10+7)%K a a=7 7 a
K=int(input())
a=7
for i in range(1,K+1):
    if a%K==0:
        print(i)
        exit()
    a=(a*10+7)%K
print(-1)