import sys
k = int(input())

def a(n):
    t = n * 10 + 7
    return t % k

a_i = 7
i = 1
if a_i % k == 0:
    print(i)
    sys.exit()

for j in range(k+1):
    a_i = a(a_i)
    i += 1
    if a_i % k == 0:
        print(i)
        sys.exit()
print(-1) import sys sys k = int(input()) k int(input()) int input() input def a(n):
    t = n * 10 + 7
    return t % k a t = n * 10 + 7 t n * 10 + 7 n * 10 n 10 7 return t % k t % k t k n n a_i = 7 a_i 7 i = 1 i 1 if a_i % k == 0:
    print(i)
    sys.exit() a_i % k == 0 a_i % k a_i k 0 print(i) print i sys.exit() sys.exit sys exit for j in range(k+1):
    a_i = a(a_i)
    i += 1
    if a_i % k == 0:
        print(i)
        sys.exit() j range(k+1) range k+1 k 1 a_i = a(a_i) a_i a(a_i) a a_i i += 1 i 1 if a_i % k == 0:
        print(i)
        sys.exit() a_i % k == 0 a_i % k a_i k 0 print(i) print i sys.exit() sys.exit sys exit print(-1) print -1 a_i = 7 7 a_i def a(n):
    t = n * 10 + 7
    return t % k def a(n):
    t = n * 10 + 7
    return t % k a a_i = a(a_i) a(a_i) a_i i += 1 1 i i = 1 1 i k = int(input()) int(input()) k
import sys
k = int(input())

def a(n):
    t = n * 10 + 7
    return t % k

a_i = 7
i = 1
if a_i % k == 0:
    print(i)
    sys.exit()

for j in range(k+1):
    a_i = a(a_i)
    i += 1
    if a_i % k == 0:
        print(i)
        sys.exit()
print(-1)
