K = int(input())
count = 1
n = 0
if K % 2 == 0 or K % 5 == 0:
    count = -1
    print(count)
else:
    while True:
        n = (n*10+7)%K
        if n == 0:
            break
        count += 1
    print(count) K = int(input()) K int(input()) int input() input count = 1 count 1 n = 0 n 0 if K % 2 == 0 or K % 5 == 0:
    count = -1
    print(count)
else:
    while True:
        n = (n*10+7)%K
        if n == 0:
            break
        count += 1
    print(count) K % 2 == 0 or K % 5 == 0 K % 2 == 0 K % 2 K 2 0 K % 5 == 0 K % 5 K 5 0 count = -1 count -1 print(count) print count while True:
        n = (n*10+7)%K
        if n == 0:
            break
        count += 1
     True n = (n*10+7)%K n (n*10+7)%K n*10+7 n*10 n 10 7 K if n == 0:
            break
         n == 0 n 0 break count += 1 count 1 print(count) print count count += 1 1 count count = -1 -1 count K = int(input()) int(input()) K count = 1 1 count n = (n*10+7)%K (n*10+7)%K n n = 0 0 n
K = int(input())
count = 1
n = 0
if K % 2 == 0 or K % 5 == 0:
    count = -1
    print(count)
else:
    while True:
        n = (n*10+7)%K
        if n == 0:
            break
        count += 1
    print(count)