K = int(input())

ans = -1

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

ans = -1

r = 7 % K
SUM = r
if SUM % K == 0:
    ans = 1
else:
    for i in range(1, K):
        r = (r * 10) % K
        SUM += r
        if SUM % K == 0:
            ans = i + 1
            break
    
print(ans)