K = int(input())

ans = -1
num7 = 7

for i in range(1000000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = (num7*10+7)%K
        i+=1

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

ans = -1
num7 = 7

for i in range(1000000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = (num7*10+7)%K
        i+=1

print(ans)