k = int(input())
ans = 1
seven = 7
for i in range(k):
    if seven % k == 0:
        print(ans)
        exit()
    seven = (seven * 10 + 7) % k
    ans += 1
print(-1) k = int(input()) k int(input()) int input() input ans = 1 ans 1 seven = 7 seven 7 for i in range(k):
    if seven % k == 0:
        print(ans)
        exit()
    seven = (seven * 10 + 7) % k
    ans += 1 i range(k) range k if seven % k == 0:
        print(ans)
        exit()
     seven % k == 0 seven % k seven k 0 print(ans) print ans exit() exit seven = (seven * 10 + 7) % k seven (seven * 10 + 7) % k seven * 10 + 7 seven * 10 seven 10 7 k ans += 1 ans 1 print(-1) print -1 k = int(input()) int(input()) k ans = 1 1 ans ans += 1 1 ans seven = 7 7 seven seven = (seven * 10 + 7) % k (seven * 10 + 7) % k seven
k = int(input())
ans = 1
seven = 7
for i in range(k):
    if seven % k == 0:
        print(ans)
        exit()
    seven = (seven * 10 + 7) % k
    ans += 1
print(-1)