import math
k=int(input())
if(k%2)==0:
    print("-1")
else:
    flag=0
    for x in range(1,1000001):
        if (7%(9*k)*(pow(10,x,k*9)-1)%(9*k))==0:
            print(x)
            flag=1
            break
    if flag==0:
        print(-1) import math math k=int(input()) k int(input()) int input() input if(k%2)==0:
    print("-1")
else:
    flag=0
    for x in range(1,1000001):
        if (7%(9*k)*(pow(10,x,k*9)-1)%(9*k))==0:
            print(x)
            flag=1
            break
    if flag==0:
        print(-1) (k%2)==0 k%2 k 2 0 print("-1") print "-1" flag=0 flag 0 for x in range(1,1000001):
        if (7%(9*k)*(pow(10,x,k*9)-1)%(9*k))==0:
            print(x)
            flag=1
            break
     x range(1,1000001) range 1 1000001 if (7%(9*k)*(pow(10,x,k*9)-1)%(9*k))==0:
            print(x)
            flag=1
            break
     (7%(9*k)*(pow(10,x,k*9)-1)%(9*k))==0 7%(9*k)*(pow(10,x,k*9)-1)%(9*k) 7%(9*k)*(pow(10,x,k*9)-1) 7%(9*k) 7 9*k 9 k pow(10,x,k*9)-1 pow(10,x,k*9) pow 10 x k*9 k 9 1 9*k 9 k 0 print(x) print x flag=1 flag 1 break if flag==0:
        print(-1) flag==0 flag 0 print(-1) print -1 k=int(input()) int(input()) k flag=0 0 flag flag=1 1 flag
import math
k=int(input())
if(k%2)==0:
    print("-1")
else:
    flag=0
    for x in range(1,1000001):
        if (7%(9*k)*(pow(10,x,k*9)-1)%(9*k))==0:
            print(x)
            flag=1
            break
    if flag==0:
        print(-1)
