
K = int(input())


if K % 2 == 0:
    print(-1)

else:
    seen = set()
    ans = 1
    num = 7
    while ans <= K:

        mod = num % K
        if mod in seen:
            ans = -1
            break
        else:
            seen.add(mod)
        
        if mod == 0:
            break
        else:
            num = mod * 10 + 7
            ans += 1
    
    print(ans)
 K = int(input()) K int(input()) int input() input if K % 2 == 0:
    print(-1)

else:
    seen = set()
    ans = 1
    num = 7
    while ans <= K:

        mod = num % K
        if mod in seen:
            ans = -1
            break
        else:
            seen.add(mod)
        
        if mod == 0:
            break
        else:
            num = mod * 10 + 7
            ans += 1
    
    print(ans) K % 2 == 0 K % 2 K 2 0 print(-1) print -1 seen = set() seen set() set ans = 1 ans 1 num = 7 num 7 while ans <= K:

        mod = num % K
        if mod in seen:
            ans = -1
            break
        else:
            seen.add(mod)
        
        if mod == 0:
            break
        else:
            num = mod * 10 + 7
            ans += 1
    
     ans <= K ans K mod = num % K mod num % K num K if mod in seen:
            ans = -1
            break
        else:
            seen.add(mod)
        
         mod in seen mod seen ans = -1 ans -1 break seen.add(mod) seen.add seen add mod if mod == 0:
            break
        else:
            num = mod * 10 + 7
            ans += 1
    
     mod == 0 mod 0 break num = mod * 10 + 7 num mod * 10 + 7 mod * 10 mod 10 7 ans += 1 ans 1 print(ans) print ans ans = -1 -1 ans K = int(input()) int(input()) K num = 7 7 num num = mod * 10 + 7 mod * 10 + 7 num mod = num % K num % K mod ans += 1 1 ans seen = set() set() seen ans = 1 1 ans

K = int(input())


if K % 2 == 0:
    print(-1)

else:
    seen = set()
    ans = 1
    num = 7
    while ans <= K:

        mod = num % K
        if mod in seen:
            ans = -1
            break
        else:
            seen.add(mod)
        
        if mod == 0:
            break
        else:
            num = mod * 10 + 7
            ans += 1
    
    print(ans)

