k=int(input())
count=1
num=7
for _ in range(k):
    if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7
else:
    print(-1) k=int(input()) k int(input()) int input() input count=1 count 1 num=7 num 7 for _ in range(k):
    if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7
else:
    print(-1) _ range(k) range k if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7 num%k == 0 num%k num k 0 print(count) print count break count += 1 count 1 num = (num % k)*10 + 7 num (num % k)*10 + 7 (num % k)*10 num % k num k 10 7 print(-1) print -1 num=7 7 num num = (num % k)*10 + 7 (num % k)*10 + 7 num count=1 1 count k=int(input()) int(input()) k count += 1 1 count
k=int(input())
count=1
num=7
for _ in range(k):
    if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7
else:
    print(-1)