k = int(input())
rem = 7%k
for i in range(10**6+1):
    if rem == 0:
        print(i+1)
        break
    rem = (rem*10+7)%k
else:
    print(-1) k = int(input()) k int(input()) int input() input rem = 7%k rem 7%k 7 k for i in range(10**6+1):
    if rem == 0:
        print(i+1)
        break
    rem = (rem*10+7)%k
else:
    print(-1) i range(10**6+1) range 10**6+1 10**6 10 6 1 if rem == 0:
        print(i+1)
        break
     rem == 0 rem 0 print(i+1) print i+1 i 1 break rem = (rem*10+7)%k rem (rem*10+7)%k rem*10+7 rem*10 rem 10 7 k print(-1) print -1 rem = 7%k 7%k rem rem = (rem*10+7)%k (rem*10+7)%k rem k = int(input()) int(input()) k
k = int(input())
rem = 7%k
for i in range(10**6+1):
    if rem == 0:
        print(i+1)
        break
    rem = (rem*10+7)%k
else:
    print(-1)