k = int(input())
n = 7

cnt = 1

for i in range(k):
    if n % k == 0:
        break
    n = (n*10 + 7) % k
    cnt += 1

if n % k == 0:
    print(cnt)
else:
    print(-1)
    
 k = int(input()) k int(input()) int input() input n = 7 n 7 cnt = 1 cnt 1 for i in range(k):
    if n % k == 0:
        break
    n = (n*10 + 7) % k
    cnt += 1 i range(k) range k 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 cnt += 1 cnt 1 if n % k == 0:
    print(cnt)
else:
    print(-1)
     n % k == 0 n % k n k 0 print(cnt) print cnt print(-1) print -1 n = (n*10 + 7) % k (n*10 + 7) % k n k = int(input()) int(input()) k n = 7 7 n cnt += 1 1 cnt cnt = 1 1 cnt
k = int(input())
n = 7

cnt = 1

for i in range(k):
    if n % k == 0:
        break
    n = (n*10 + 7) % k
    cnt += 1

if n % k == 0:
    print(cnt)
else:
    print(-1)
    

