k = int(input())
s = 7
num = 1
res = True
if k == 2:
    print(-1)
else:
    for i in range(k):
        s %= k
        if s == 0:
            res = False
            print(num)
            break
        num += 1
        s *= 10
        s += 7
    if res:
        print(-1) k = int(input()) k int(input()) int input() input s = 7 s 7 num = 1 num 1 res = True res True if k == 2:
    print(-1)
else:
    for i in range(k):
        s %= k
        if s == 0:
            res = False
            print(num)
            break
        num += 1
        s *= 10
        s += 7
    if res:
        print(-1) k == 2 k 2 print(-1) print -1 for i in range(k):
        s %= k
        if s == 0:
            res = False
            print(num)
            break
        num += 1
        s *= 10
        s += 7
     i range(k) range k s %= k s k if s == 0:
            res = False
            print(num)
            break
         s == 0 s 0 res = False res False print(num) print num break num += 1 num 1 s *= 10 s 10 s += 7 s 7 if res:
        print(-1) res print(-1) print -1 k = int(input()) int(input()) k num = 1 1 num res = True True res s = 7 7 s s %= k k s res = False False res num += 1 1 num s += 7 7 s s *= 10 10 s
k = int(input())
s = 7
num = 1
res = True
if k == 2:
    print(-1)
else:
    for i in range(k):
        s %= k
        if s == 0:
            res = False
            print(num)
            break
        num += 1
        s *= 10
        s += 7
    if res:
        print(-1)