K=int(input())
sevens=7
result=1
if K%2==0 or K%5==0:
    print(-1)
else:
    while sevens%K!=0:
        sevens%=K
        sevens=sevens*10+7
        result+=1
    print(result) K=int(input()) K int(input()) int input() input sevens=7 sevens 7 result=1 result 1 if K%2==0 or K%5==0:
    print(-1)
else:
    while sevens%K!=0:
        sevens%=K
        sevens=sevens*10+7
        result+=1
    print(result) K%2==0 or K%5==0 K%2==0 K%2 K 2 0 K%5==0 K%5 K 5 0 print(-1) print -1 while sevens%K!=0:
        sevens%=K
        sevens=sevens*10+7
        result+=1
     sevens%K!=0 sevens%K sevens K 0 sevens%=K sevens K sevens=sevens*10+7 sevens sevens*10+7 sevens*10 sevens 10 7 result+=1 result 1 print(result) print result sevens=sevens*10+7 sevens*10+7 sevens K=int(input()) int(input()) K result=1 1 result sevens=7 7 sevens sevens%=K K sevens result+=1 1 result
K=int(input())
sevens=7
result=1
if K%2==0 or K%5==0:
    print(-1)
else:
    while sevens%K!=0:
        sevens%=K
        sevens=sevens*10+7
        result+=1
    print(result)