k = int(input())
seven = 0
i = 0
if k % 2 == 0:
    print(-1)
else:
    while True:
        i += 1
        seven = seven * 10 + 7
        seven = seven % k
        if seven == 0:
            print(i)
            break
        if i>1000000:
            print(-1)
            break k = int(input()) k int(input()) int input() input seven = 0 seven 0 i = 0 i 0 if k % 2 == 0:
    print(-1)
else:
    while True:
        i += 1
        seven = seven * 10 + 7
        seven = seven % k
        if seven == 0:
            print(i)
            break
        if i>1000000:
            print(-1)
            break k % 2 == 0 k % 2 k 2 0 print(-1) print -1 while True:
        i += 1
        seven = seven * 10 + 7
        seven = seven % k
        if seven == 0:
            print(i)
            break
        if i>1000000:
            print(-1)
            break True i += 1 i 1 seven = seven * 10 + 7 seven seven * 10 + 7 seven * 10 seven 10 7 seven = seven % k seven seven % k seven k if seven == 0:
            print(i)
            break
         seven == 0 seven 0 print(i) print i break if i>1000000:
            print(-1)
            break i>1000000 i 1000000 print(-1) print -1 break seven = seven * 10 + 7 seven * 10 + 7 seven seven = seven % k seven % k seven i += 1 1 i k = int(input()) int(input()) k seven = 0 0 seven i = 0 0 i
k = int(input())
seven = 0
i = 0
if k % 2 == 0:
    print(-1)
else:
    while True:
        i += 1
        seven = seven * 10 + 7
        seven = seven % k
        if seven == 0:
            print(i)
            break
        if i>1000000:
            print(-1)
            break