K = int(input())

ans = 1
num = 0
seven = 7

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

ans = 1
num = 0
seven = 7

if not K%2:
    print(-1)
else:
    for i in range(K):
        num = num + seven
        seven = seven*10%K
        num = num%K
        if num == 0:
            print(ans)
            break
        ans += 1
    else:
        print(-1)