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