k = int(input())
seven = 7
ans = -1

for i in range(1,k+1):
    seven %= k
    if seven  == 0:
        ans = i
        break
    else:
        seven = seven * 10 + 7

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

for i in range(1,k+1):
    seven %= k
    if seven  == 0:
        ans = i
        break
    else:
        seven = seven * 10 + 7

print(ans)