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