k = int(input())
sevens = 7 % k

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

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