k=int(input())
a=7
cnt=1
while cnt<=k+2:
    if a%k==0:
        print(cnt)
        flag=True
        break
    else:
        flag=False
        cnt+=1
        a=(10*a+7)%k
if not flag:
    print(-1) k=int(input()) k int(input()) int input() input a=7 a 7 cnt=1 cnt 1 while cnt<=k+2:
    if a%k==0:
        print(cnt)
        flag=True
        break
    else:
        flag=False
        cnt+=1
        a=(10*a+7)%k cnt<=k+2 cnt k+2 k 2 if a%k==0:
        print(cnt)
        flag=True
        break
    else:
        flag=False
        cnt+=1
        a=(10*a+7)%k a%k==0 a%k a k 0 print(cnt) print cnt flag=True flag True break flag=False flag False cnt+=1 cnt 1 a=(10*a+7)%k a (10*a+7)%k 10*a+7 10*a 10 a 7 k if not flag:
    print(-1) not flag flag print(-1) print -1 a=7 7 a cnt=1 1 cnt flag=False False flag k=int(input()) int(input()) k a=(10*a+7)%k (10*a+7)%k a flag=True True flag cnt+=1 1 cnt
k=int(input())
a=7
cnt=1
while cnt<=k+2:
    if a%k==0:
        print(cnt)
        flag=True
        break
    else:
        flag=False
        cnt+=1
        a=(10*a+7)%k
if not flag:
    print(-1)
