import sys
K = int(input())

x = 7
for ans in range(1, K*2):

    if  x%K == 0:
        print(ans)
        sys.exit()

    x = (x*10 + 7) % K
print(-1) import sys sys K = int(input()) K int(input()) int input() input x = 7 x 7 for ans in range(1, K*2):

    if  x%K == 0:
        print(ans)
        sys.exit()

    x = (x*10 + 7) % K ans range(1, K*2) range 1 K*2 K 2 if  x%K == 0:
        print(ans)
        sys.exit()

     x%K == 0 x%K x K 0 print(ans) print ans sys.exit() sys.exit sys exit x = (x*10 + 7) % K x (x*10 + 7) % K x*10 + 7 x*10 x 10 7 K print(-1) print -1 x = 7 7 x x = (x*10 + 7) % K (x*10 + 7) % K x K = int(input()) int(input()) K
import sys
K = int(input())

x = 7
for ans in range(1, K*2):

    if  x%K == 0:
        print(ans)
        sys.exit()

    x = (x*10 + 7) % K
print(-1)