K = int(input())
tmp = 7
for i in range(1,K+1):
    if tmp%K == 0:
        print(i)
        exit()
    tmp = (tmp*10 + 7)%K
    tmp %= K
print(-1) K = int(input()) K int(input()) int input() input tmp = 7 tmp 7 for i in range(1,K+1):
    if tmp%K == 0:
        print(i)
        exit()
    tmp = (tmp*10 + 7)%K
    tmp %= K i range(1,K+1) range 1 K+1 K 1 if tmp%K == 0:
        print(i)
        exit()
     tmp%K == 0 tmp%K tmp K 0 print(i) print i exit() exit tmp = (tmp*10 + 7)%K tmp (tmp*10 + 7)%K tmp*10 + 7 tmp*10 tmp 10 7 K tmp %= K tmp K print(-1) print -1 tmp %= K K tmp tmp = 7 7 tmp K = int(input()) int(input()) K tmp = (tmp*10 + 7)%K (tmp*10 + 7)%K tmp
K = int(input())
tmp = 7
for i in range(1,K+1):
    if tmp%K == 0:
        print(i)
        exit()
    tmp = (tmp*10 + 7)%K
    tmp %= K
print(-1)