import math

k = int(input())
value = 7

isTrue = 0
for i in range(1, 10**6):
    if value % k == 0:
        isTrue = 1
        print(i)
        break
    value = (value * 10 + 7) % k

if not isTrue:
    print(-1) import math math k = int(input()) k int(input()) int input() input value = 7 value 7 isTrue = 0 isTrue 0 for i in range(1, 10**6):
    if value % k == 0:
        isTrue = 1
        print(i)
        break
    value = (value * 10 + 7) % k i range(1, 10**6) range 1 10**6 10 6 if value % k == 0:
        isTrue = 1
        print(i)
        break
     value % k == 0 value % k value k 0 isTrue = 1 isTrue 1 print(i) print i break value = (value * 10 + 7) % k value (value * 10 + 7) % k value * 10 + 7 value * 10 value 10 7 k if not isTrue:
    print(-1) not isTrue isTrue print(-1) print -1 value = (value * 10 + 7) % k (value * 10 + 7) % k value isTrue = 0 0 isTrue k = int(input()) int(input()) k value = 7 7 value isTrue = 1 1 isTrue
import math

k = int(input())
value = 7

isTrue = 0
for i in range(1, 10**6):
    if value % k == 0:
        isTrue = 1
        print(i)
        break
    value = (value * 10 + 7) % k

if not isTrue:
    print(-1)