# -*- coding: utf-8 -*-
k = int(input())
ans = 0
n = 7

if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit(0)
c = 1
while True:
    if n % k == 0:
        break
    n = (n * 10 + 7) % k
    c += 1

print(c) k = int(input()) k int(input()) int input() input ans = 0 ans 0 n = 7 n 7 if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit(0) k % 2 == 0 or k % 5 == 0 k % 2 == 0 k % 2 k 2 0 k % 5 == 0 k % 5 k 5 0 print(-1) print -1 exit(0) exit 0 c = 1 c 1 while True:
    if n % k == 0:
        break
    n = (n * 10 + 7) % k
    c += 1 True if n % k == 0:
        break
     n % k == 0 n % k n k 0 break n = (n * 10 + 7) % k n (n * 10 + 7) % k n * 10 + 7 n * 10 n 10 7 k c += 1 c 1 print(c) print c k = int(input()) int(input()) k n = (n * 10 + 7) % k (n * 10 + 7) % k n ans = 0 0 ans c += 1 1 c n = 7 7 n c = 1 1 c
# -*- coding: utf-8 -*-
k = int(input())
ans = 0
n = 7

if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit(0)
c = 1
while True:
    if n % k == 0:
        break
    n = (n * 10 + 7) % k
    c += 1

print(c)
