K = int(input())

if(7%K == 0):
    print(1)
else:
    mod = 7%K
    for i in range(2, K+1):
        if(mod * 10 + 7)%K == 0:
            print(i)
            break
        mod = (mod * 10 + 7)%K
    else:
        print(-1) K = int(input()) K int(input()) int input() input if(7%K == 0):
    print(1)
else:
    mod = 7%K
    for i in range(2, K+1):
        if(mod * 10 + 7)%K == 0:
            print(i)
            break
        mod = (mod * 10 + 7)%K
    else:
        print(-1) 7%K == 0 7%K 7 K 0 print(1) print 1 mod = 7%K mod 7%K 7 K for i in range(2, K+1):
        if(mod * 10 + 7)%K == 0:
            print(i)
            break
        mod = (mod * 10 + 7)%K
    else:
        print(-1) i range(2, K+1) range 2 K+1 K 1 if(mod * 10 + 7)%K == 0:
            print(i)
            break
         (mod * 10 + 7)%K == 0 (mod * 10 + 7)%K mod * 10 + 7 mod * 10 mod 10 7 K 0 print(i) print i break mod = (mod * 10 + 7)%K mod (mod * 10 + 7)%K mod * 10 + 7 mod * 10 mod 10 7 K print(-1) print -1 mod = 7%K 7%K mod mod = (mod * 10 + 7)%K (mod * 10 + 7)%K mod K = int(input()) int(input()) K
K = int(input())

if(7%K == 0):
    print(1)
else:
    mod = 7%K
    for i in range(2, K+1):
        if(mod * 10 + 7)%K == 0:
            print(i)
            break
        mod = (mod * 10 + 7)%K
    else:
        print(-1)