k=int(input())
if k%2==0:
    print(-1)
else:
    n=7
    cnt=1
    l={}
    while n%k!=0:
        if n not in l:
            l[n]=1
        else:
            print(-1)
            exit()
        n=(n*10+7)%k
        cnt+=1
    print(cnt) k=int(input()) k int(input()) int input() input if k%2==0:
    print(-1)
else:
    n=7
    cnt=1
    l={}
    while n%k!=0:
        if n not in l:
            l[n]=1
        else:
            print(-1)
            exit()
        n=(n*10+7)%k
        cnt+=1
    print(cnt) k%2==0 k%2 k 2 0 print(-1) print -1 n=7 n 7 cnt=1 cnt 1 l={} l {} while n%k!=0:
        if n not in l:
            l[n]=1
        else:
            print(-1)
            exit()
        n=(n*10+7)%k
        cnt+=1
     n%k!=0 n%k n k 0 if n not in l:
            l[n]=1
        else:
            print(-1)
            exit()
         n not in l n l l[n]=1 l[n] l n 1 print(-1) print -1 exit() exit n=(n*10+7)%k n (n*10+7)%k n*10+7 n*10 n 10 7 k cnt+=1 cnt 1 print(cnt) print cnt n=(n*10+7)%k (n*10+7)%k n n=7 7 n k=int(input()) int(input()) k l={} {} l cnt=1 1 cnt cnt+=1 1 cnt
k=int(input())
if k%2==0:
    print(-1)
else:
    n=7
    cnt=1
    l={}
    while n%k!=0:
        if n not in l:
            l[n]=1
        else:
            print(-1)
            exit()
        n=(n*10+7)%k
        cnt+=1
    print(cnt)