k = int(input())
x = 7 % k
i = 1
set = set()
is_there = False

while not is_there:
    set.add(x)
    if x == 0:
        print(i)
        break
    x = (x*10+7) % k
    if x in set:
        is_there = True
    set.add(x)
    i += 1
    if x == 0:
        print(i)
        break
else:
    print('-1') k = int(input()) k int(input()) int input() input x = 7 % k x 7 % k 7 k i = 1 i 1 set = set() set set() set is_there = False is_there False while not is_there:
    set.add(x)
    if x == 0:
        print(i)
        break
    x = (x*10+7) % k
    if x in set:
        is_there = True
    set.add(x)
    i += 1
    if x == 0:
        print(i)
        break
else:
    print('-1') not is_there is_there set.add(x) set.add set add x if x == 0:
        print(i)
        break
     x == 0 x 0 print(i) print i break x = (x*10+7) % k x (x*10+7) % k x*10+7 x*10 x 10 7 k if x in set:
        is_there = True
     x in set x set is_there = True is_there True set.add(x) set.add set add x i += 1 i 1 if x == 0:
        print(i)
        break x == 0 x 0 print(i) print i break print('-1') print '-1' is_there = True True is_there i += 1 1 i is_there = False False is_there x = 7 % k 7 % k x k = int(input()) int(input()) k x = (x*10+7) % k (x*10+7) % k x i = 1 1 i set = set() set() set
k = int(input())
x = 7 % k
i = 1
set = set()
is_there = False

while not is_there:
    set.add(x)
    if x == 0:
        print(i)
        break
    x = (x*10+7) % k
    if x in set:
        is_there = True
    set.add(x)
    i += 1
    if x == 0:
        print(i)
        break
else:
    print('-1')