CodeEff/ECCO huggingface dataset:
# Original solution
K = int(eval(input()))

if K % 2 == 0:
    print((-1))
    exit()
rest = 7 % K
x = rest
ans = 1
while rest:
    ans += 1
    x = x*10 % K
    rest = (rest + x) % K
print(ans)

# Optimized solution
K = int(eval(input()))

if K % 2 == 0 or K % 5 == 0:
    print((-1))
    exit()
rest = 7 % K
x = rest
ans = 1
while rest:
    ans += 1
    x = x*10 % K
    rest = (rest + x) % K
print(ans)
# Original solution
k = int(eval(input()))
if k % 2 == 0:
    print((-1))
    exit()
modk = 7 % k
num = 0
for i in range(1,10**7):
    num = (num+modk)%k
    if num == 0:
        print(i)
        exit()
    modk = (modk * 10)%k
print((-1))

# Optimized solution
k = int(eval(input()))
if k % 2 == 0:
    print((-1))
    exit()
modk = 7 % k
num = 0
for i in range(1,10**8):
    num = (num+modk)%k
    if num == 0:
        print(i)
        exit()
    modk = (modk * 10)%k
print((-1))
# Original solution
k = int(eval(input()))
x = 7
ans = 1
s = set()
while x%k != 0:
    ans += 1
    x = (x*10%k+7)%k
    if x in s:
        ans = -1
        break
    s.add(x)
print(ans)

# Optimized solution
k = int(eval(input()))
x = 7
ans = 1
flag = [False]*k
while x%k != 0:
    ans += 1
    x = (x*10%k+7)%k
    if flag[x]:
        ans = -1
        break
    flag[x] = True
print(ans)
# Original solution
k = int(eval(input()))
x, i = 0, 0
r = set()
while True:
    x = (x * 10 + 7) % k
    i += 1
    if x == 0:
        break
    if x in r:
        print((-1))
        quit()
    r.add(x)
print(i)

# Optimized solution
def power(x, n, mod):
    ans = 1
    while n > 0:
        if n % 2 == 1:
            ans = ans * x % mod
        n //= 2
        x = x * x % mod
    return ans

def eular(n):
    ans = 1
    if n % 2 == 0:
        x = 1
        while n % 2 == 0:
            n //= 2
            x *= 2
        ans *= x - x // 2
    i = 3
    while i * i <= n:
        if n % i == 0:
            x = 1
            while n % i == 0:
                n //= i
                x *= i
            ans *= x - x // i
        i += 2
    if n != 1:
        ans *= n - 1
    return ans

k = int(eval(input()))

if k % 2 == 0 or k % 5 == 0:
    print((-1))
    quit()
elif k % 7 == 0:
    l = 9 * k // 7
else:
    l = 9 * k

phi_l = eular(l)
ans = phi_l
d, x = 10, 1
while x * x <= phi_l:
    if phi_l % x == 0:
        if d % l == 1:
            ans = x
            break
        else:
            y = phi_l // x
            if pow(10, y, l) == 1:
                ans = y
    d = d * 10 % l
    x += 1
print(ans)
# Original solution
K = int(eval(input()))
used = set()
pos = 1
v = 0

while 1:
    v += 7*pow(10, pos-1, K)
    v %= K
    if v==0:
        print(pos)
        break
    if v in used:
        print((-1))
        break
    used.add(v)
    pos += 1

# Optimized solution
K = int(eval(input()))
used = set()
pos = 1
v = 0

while 1:
    v = (10*v+7)%K
    if v==0:
        print(pos)
        break
    if v in used:
        print((-1))
        break
    used.add(v)
    pos += 1
# Original solution
K = int(eval(input()))

import sys
if K%2 == 0 or K%5 == 0:
    print((-1))
    sys.exit()
mod = 0

for i in range(1000000):
    mod += (7*pow(10,i,K))%K
    mod = mod%K
    if mod%K == 0:
        print((i+1))
        sys.exit()

# Optimized solution
import sys

K = int(eval(input()))
tmp = 0
for i in range(1,10**7):
    tmp = (tmp*10+7)%K
    if tmp == 0:
        print(i)
        sys.exit()
        
print((-1))
# Original solution
k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
    memo = ((memo % k) * (10 % k)) % k
    mod = (mod + 7 * memo) % k
    if mod not in mod_map:
        mod_map.add(mod)
    else:
        counter = -1
        break
    counter += 1
    if mod == 0:
        break
print(counter)


# Optimized solution
k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
    mod = ((mod * 10) % k + 7) % k
    if mod not in mod_map:
        mod_map.add(mod)
    else:
        counter = -1
        break
    counter += 1
    if mod == 0:
        break
print(counter)
# Original solution
k = int(eval(input()))
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
    mod = ((mod * 10) % k + 7) % k
    if mod not in mod_map:
        mod_map.add(mod)
    else:
        counter = -1
        break
    counter += 1
    if mod == 0:
        break
print(counter)


# Optimized solution
k = int(eval(input()))
mod = 0

for i in range(1, k + 1):
    mod = ((mod * 10) % k + 7) % k
    if mod == 0:
        print(i)
        break
else:
    print((-1))
# Original solution
K = int(eval(input()))
if K%2 == 0:
    print((-1))
elif K%5 == 0:
    print((-1))
else:
    res = 7
    for i in range(K):
        if res % K == 0:
            break
        res = (res * 10 + 7) % K
    print((i + 1))

# Optimized solution
K = int(eval(input()))
res = 7 % K
for i in range(K):
    if res == 0:
        ans = i+1
        break
    res = (res * 10 + 7) % K
if res != 0:
    ans = -1
print(ans)
# Original solution
K = int(eval(input()))

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

i = 0
sevens = 0
while True:
    sevens += 7 * pow(10, i, K)
    sevens %= K
    i += 1
    if sevens == 0:
        break
print(i)


# Optimized solution
K = int(eval(input()))

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

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)
# Original solution
k=int(input())
x=i=0
while i<7e6:i+=1;x=(x*10+7)%k;x<1>exit(print(i))
print(-1)


# Optimized solution
k=int(input())
x=i=0
while i<k:i+=1;x=(x*10+7)%k;x<1>exit(print(i))
print(-1)
# Original solution
k = int(eval(input()))

if k % 2 == 0:
  print("-1")
  quit()

num = 1
cnt = 1
if k % 7 ==0:
  k = k//7

while True:
  num = num % k
  if num == 0:
    print(cnt)
    break
  else:
    num += pow(10, cnt, k)
    cnt += 1
  

# Optimized solution
def main(k):
  if k % 2 == 0:
    return -1

  num = 1
  cnt = 1
  if k % 7 == 0:
    k = k//7

  for i in range(1000000):
    num = num % k
    if num == 0:
      return cnt
    else:
      num += pow(10, cnt, k)
      cnt += 1
  return -1

k = int(eval(input()))
print((main(k)))
# Original solution
K = int(eval(input()))
n = 7%K
r = 1
for i in range(10**6+5):
    if n==0:
        print((i+1))
        exit()
    r *= 10
    n += r*7
    r %= K
    n %= K
    #print(r,n)
print((-1))

# Optimized solution
K = int(eval(input()))

k = 1
a = 7
for i in range(10**6+5):
    if a%K == 0:
        print(k)
        exit()
    a = (a*10 + 7) % K
    k += 1
    
print((-1))
# Original solution
# -*- coding: utf-8 -*-
# template: v1.3.1

# 倍数問題では、N(i)%k は k 以内でループする...はず。実際している…
# 桁落としは、mod 途中実行でできる…了解...！！！！！合点！！！！

import io
import sys
import math

### DEBUG ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
999983
"""
_EXPECTED = """\
4

"""
if _DEB:
    sys.stdin = io.StringIO(_INPUT)
    print("!! Debug Mode !!")

def logd(str):
    if _DEB: print(f"[deb] {str}")


### INPUT ####
k = int(eval(input()))

### Solve ####
def solve():
    # Process
    ans=-1
    mod_set=set()
    modx=10**9+7
    i=1
    n7=7%k
    while True:
        if n7==0:
            ans=i
            break
        if n7 in mod_set:
            break
        mod_set.add(n7)
        # 7777... の連続生成は、こうすると合理的。桁あふれもここで防ぐ。
        n7=(n7*10+7)%k
        i+=1
    # OUPUT
    ans = str(ans)
    print(ans)
    return ans

### MAIN ###
if __name__ == "__main__":
    ans = solve()

    # Checker
    if _DEB:
        if _EXPECTED.strip() == ans.strip(): print("\n!! Success !!")
        else: print(f"\n!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

# Optimized solution
k=int(eval(input()))
n=7%k
for i in range(1,k+1):
  if n == 0:
    print(i)
    exit()
  n=(n*10+7) % k
print((-1))
# Original solution
k=int(eval(input()))
n=7%k
s=set()
i=1
while n not in s:
  if n == 0:
    print(i)
    exit()
  s.add(n)
  n=(10*n+7) %k
  i+=1
print((-1))

# Optimized solution
# Cyclic mod calculation renshuu

# kの倍数 -> N % k == 0 を探索する
# N%k の値は高々 k種類となる。k回のループで十分に網羅できる。
# kは10**6。制約上も問題がない。
k=int(eval(input()))
n=7%k
for i in range(1,k+1):
  if n==0:
    print(i)
    exit()
  # 計算量を抑えてmodするため、漸化式のような実装にすることがミソ。
  n=(n*10+7)%k 
print((-1))
# Original solution
k = int(eval(input()))

num = 1 
n = 7
x = True
 
if (k%2 == 0):
  x = False
  print((-1))

while x:
  if (n%k == 0):
    print(num)
    break
  else:
    n = (n*10 + 7)%k
    num += 1


# Optimized solution
def main():
    k = int(eval(input()))

    num = 1 
    n = 7
    
    if (k%2 == 0):
        print((-1))
        return
    

    for i in range(1000000):
        if (n%k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7)%k
            num += 1

    print((-1))
    
if __name__ == "__main__":
    main()
# Original solution
n = int(input().rstrip())

def calc(target):
    excess = set()
    result = 0
    count = 0
    if target % 2 == 0:
        return -1
        
    while True:
        count += 1
        result = (result * 10 + 7) % target
        excess.add(result)
        if result == 0:
            break
    
    return count
    
print((calc(n)))

# Optimized solution
n = int(input().rstrip())

def calc(target):
    result = 0
    count = 0
    if target % 2 == 0:
        print((-1))
        return
        
    for i in range(n):
        result = (result * 10 + 7) % target
        count += 1
        if result == 0:
            print(count)
            return
    
    print((-1))
    
calc(n)
# Original solution
K = int(eval(input()))

def calculate(k):

    res = 1

    n = 7

    if k % 2 == 0:
        print((-1))
        return

    if k % 5 == -1:
        print((-1))
        return

    while n % k > 0:
        n = n % k
        n = n * 10 + 7
        res += 1

    print(res)

calculate(K)

# Optimized solution
K = int(eval(input()))

def calculate(k):

    if k % 2 == 0:
        print((-1))
        return

    if k % 5 == 0:
        print((-1))
        return

    res = 1

    m = (((10 ** res) - 1) // 9) * 7


    while m % k > 0:
        res += 1
        m = m % k
        m = m * 10 + 7

    print(res)


calculate(K)
# Original solution
k = int(eval(input()))
checked = [False] * k

surplus = 0
ans = 1
while 1:
    surplus = ((surplus * 10) + 7) % k
    if checked[surplus]:
        print((-1))
        exit()
    if surplus == 0:
        break
    checked[surplus] = True
    ans += 1

print(ans)


# Optimized solution

k = int(eval(input()))

surplus = 0
ans = 1
while 1:
    if ans > k:
        print((-1))
        exit()
    surplus = ((surplus * 10) + 7) % k
    if surplus == 0:
        break
    ans += 1
print(ans)
# Original solution
def main():
    K = int(eval(input()))
    if K%2 == 0 or K%5==0:
        return -1

    if K % 7 == 0:
        L = K * 9 // 7
    else:
        L = K * 9
    
    for i in range(1, 10000000):
        x = pow(10, i, L)
        if x == 1:
            return i
    else:
        return -1


if __name__ == "__main__":
    ans = main()
    print(ans)

# Optimized solution
k=int(eval(input()))
if k==7 or k==1:
    print((1))
else:
    a=7
    for i in range(1,10**6):
        a=10*a+7
        if a%k==0:
            print((i+1))
            break
        else:
            a=a%k
    else:
        print((-1))
# Original solution
k = int(eval(input()))

if k % 2 == 0:
    print((-1))
else:
    ans = 1
    num = 7 % k
    temp = 7 % k
    while True:
        if num % k == 0:
            print(ans)
            break
        else:
            ans += 1
            temp = temp * 10 % k
            num += temp % k
            num %= k


# Optimized solution
k = int(eval(input()))

if k % 2 == 0 or k % 5 == 0:
    print((-1))
else:
    ans = 1
    num = 7 % k
    temp = 7 % k
    while True:
        if num % k == 0:
            print(ans)
            break
        else:
            ans += 1
            temp = temp * 10 % k
            num += temp % k
            num %= k
# Original solution
k = int(eval(input()))

if k % 2 == 0 or k % 5 == 0:
    print((-1))
else:
    ans = 1
    num = 7
    while True:
        if int(num) % k == 0:
            print(ans)
            break
        else:
            ans += 1
            num += 7 * pow(10, ans - 1, k)
            num %= k


# Optimized solution
k = int(eval(input()))

if k % 2 == 0 or k % 5 == 0:
    print((-1))
else:
    ans = 1
    num = 7
    while True:
        if num % k == 0:
            print(ans)
            break
        else:
            ans += 1
            num += 7 * pow(10, ans - 1, k)
            num %= k
# Original solution
K = int(eval(input()))
like = 7
ans = -1
for i in range(K):
    if like % K == 0:
        ans = i+1
        break
    like = (like*10+7) % K
print(ans)


# Optimized solution
K = int(eval(input()))
ans = -1
N = 7
for i in range(K):
    if N % K == 0:
        ans = i+1
        break
    N = (N*10+7) % K
print(ans)
# Original solution
k = int(eval(input()))

ans = 0
ai = 0

if k%2 == 0:
    print((-1))
    exit()

while True:
    ai = (ai*10 + 7)% k
    ans += 1
    if ai == 0:
        break
print(ans)


# Optimized solution
K = int(eval(input()))

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

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)
# Original solution
K=int(eval(input()))
if K%2==0:
    print('-1')
    exit()
a=0
i=1
while True:
    a=(a*10+7)%K
    if a==0:
        print(i)
        break
    i+=1


# Optimized solution
K=int(eval(input()))
if K%2==0 or K%5==0:
    print('-1')
    exit()
a=0
i=1
while True:
    a=(a*10+7)%K
    if a==0:
        print(i)
        break
    i+=1
# Original solution
k = int(eval(input()))

now = 7
cnt = 1
used = [False] * k
ten = 10
while not used[now % k]:
    if now % k == 0:
        print(cnt)
        exit()
    used[now % k] = True
    now = (now + ten * 7) % k
    ten = ten * 10 % k
    cnt += 1
print((-1))


# Optimized solution
k = int(eval(input()))
n = 7
for i in range(k):
    if n % k == 0:
        print((i + 1))
        exit()
    n = (n * 10 + 7) % k
print((-1))
# Original solution
K = int(eval(input()))

a = 7
flag = False

for i in range(1,K+1):
  b = a%K
  if b==0:
    flag = True
    break
  a = b*10 + 7
if flag:
  print(i)
else:
  print((-1))

# Optimized solution
# 解答
K = int(eval(input()))
A = 7 % K 

flag = False
for i in range(1, K+1):
  if A == 0:
    flag = True
    break
  A = (A*10 + 7) % K

if flag:
  print(i)
else:
  print((-1))
# Original solution
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(K):
    m = 0
    for i in range(1, 10**6):
        m = (m * 10 + 7) % K
        if m == 0:
            print(i)
            return
    print((-1))

if __name__ == '__main__':
    input = sys.stdin.readline
    K = int(eval(input()))
    main(K)


# Optimized solution
K = int(eval(input()))
mod = 0
for i in range(K):
    mod = (10 * mod + 7) % K
    if mod == 0:
        print((i + 1))
        exit()
print((-1))
# Original solution
k = int(eval(input()))
ans = 1
num = 0
if not k%2:
    print((-1))
else:
    while True:
        num = (num*10+7)%k
        if num == 0:
            print(ans)
            break
        ans += 1

# Optimized solution
k = int(eval(input()))
num = 0
if not k%2:
    print((-1))
else:
    for i in range(k):
        num = (num*10+7)%k
        if num == 0:
            print((i+1))
            break
    else:
        print((-1))
# Original solution
import math
from functools import reduce
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def repfunc(x,y):
    a=x-1
    for i in range(1,x):
        if y%i==0 and (pow(10,i)-1)%x==0:
            a=i
            break
    return a


k=int(eval(input()))
res=1
ans1=0
ans2=0
if k%7==0:
    k//=7
if k%2==0 or k%5==0:
    print((-1))
elif k ==1:
    print((1))
else:
    c=collections.Counter(prime_factorize(k))
    c2=list(c.keys())
    d=[0 for i in range(len(c2))]
    for i in range(len(c2)):
        if c2[i]==3:
            d[i]=pow(3,c[3])
        else:
            d[i]=repfunc(pow(c2[i],c[c2[i]]),pow(c2[i],c[c2[i]]-1)*(c2[i]-1))
    print((lcm_list(d)))


# Optimized solution
k=int(eval(input()))
if k%7==0:
    k//=7
res=1
if k%2==0 or k%5==0:
    print((-1))
else:
    k*=9
    for i in range(k):
        res*=10
        if res%k==1:
            print((i+1))
            break
        else:
            res%=k
# Original solution
K = int(eval(input()))
num = 0
for i in range(1000001):
    num += 7 * pow(10, i, K)
    num %= K
    if num == 0:
        print((i + 1))
        break
else:
    print((-1))


# Optimized solution
def solve(K):
    cur = 0
    tens = 1
    for i in range(1_000_001):
        cur += 7 * tens
        cur %= K
        if cur == 0:
            return i + 1
        tens *= 10
        tens %= K
    else:
        return -1


print((solve(int(eval(input())))))
# Original solution
k=int(eval(input()))
n=7
i=1
x=7%k
if k==1 or k==7:
  print((1))
else:
  while i>=0:
    n=n*10+7
    n=n%k
    i+=1
    if n==0:
      print(i)
      break
    if n==x:
      print((-1))
      break 

# Optimized solution
k=int(eval(input()))
n=0
for i in range(1,k+1):
  n=n*10+7
  n=n%k
  if n==0:
    print(i)
    exit()
print((-1))
# Original solution
K = int(eval(input()))

a = 7 % K

for i in range(999983):
    if a == 0:
        print((i+1))
        exit()
    a = (a * 10 + 7) % K

print((-1))

# Optimized solution
K = int(eval(input()))
 
a = 7 % K
 
for i in range(K):
    if a == 0:
        print((i+1))
        exit()
    a = (a * 10 + 7) % K
 
print((-1))
# Original solution
K = int(eval(input()))
L = 0
if K % 7 == 0:
  L = 9*K//7
else:
  L = 9*K
ans = -1
a = 10
for i in range(1,L+1,1):
  if a % L == 1:
    ans = i
    break
  a = (a % L) * 10 

print(ans)

# Optimized solution
K = int(eval(input()))
L = 0
if K % 7 == 0:
  L = 9*K//7
else:
  L = 9*K
  
ans = -1
s = 10
for i in range(1,L,1):
  if s % L == 1:
    ans = i
    break
  s = s % L * 10
print(ans)
# Original solution
N=int(eval(input()))
if N%2==0:
  print((-1))
else:
  ans=1
  a=7
  num=7
  while(num%N!=0):
    a=(a*10)%N
    num=(num+a)%N
    ans+=1
  print(ans)
  


# Optimized solution
N=int(eval(input()))
if N%2==0:
  print((-1))
elif N%5==0:
  print((-1))
else:
  ans=1
  a=7
  num=7
  while(num%N!=0):
    a=(a*10)%N
    num=(num+a)%N
    ans+=1
  print(ans)
# Original solution
from sys import stdin,stdout
#for _ in range(int(stdin.readline())):
n=int(stdin.readline())
#a=list(map(int,stdin.readline().split()))
dividend=7;ans=-1
for add in range(10**7):
    rem=dividend%n
    if rem==0:
        ans=add+1
        break
    dividend=rem*10+7
print(ans)


# Optimized solution
from sys import stdin,stdout
#for _ in range(int(stdin.readline())):
n=int(stdin.readline())
#a=list(map(int,stdin.readline().split()))
dividend=7;ans=-1
for add in range(10**6+5):
    rem=dividend%n
    if rem==0:
        ans=add+1
        break
    dividend=rem*10+7
print(ans)
# Original solution
import math
import sys

def main():
    #an+1=(10~n)*7+an
    K=int(eval(input()))
    if K%2==0:
        print((-1))
        sys.exit()
    n=0
    a=7
    while True:
        if a%K==0:
            break
        n+=1
        a=(a+(pow(10,n,K)*7))%K
    print((n+1))

if __name__=="__main__":
    main()

# Optimized solution
import math
import sys

def main():
    #an+1=(10~n)*7+an
    K=int(eval(input()))

    if K%2==0:
        print((-1))
        sys.exit()
    elif K%5==0:
        print((-1))
        sys.exit()
    n=0
    a=7
    while True:
        if a%K==0:
            break
        n+=1
        a=(a+(pow(10,n,K)*7))%K
    print((n+1))

if __name__=="__main__":
    main()
# Original solution
k = int(eval(input()))
mod = 7 % k
if k % 2 == 0:
    print((-1))
else:
    ans = 1
    while mod != 0:
        mod = (10*mod + 7) % k
        ans += 1
        if ans >= 10**10:
            print((-1))
            break
    if ans < 10**10:
        print(ans)

# Optimized solution
k = int(eval(input()))
mod = 7 % k
if k % 2 == 0:
    print((-1))
else:
    ans = 1
    while mod != 0:
        mod = (10*mod + 7) % k
        ans += 1
        if ans >= 10**7:
            print((-1))
            break
    if ans < 10**7:
        print(ans)
# Original solution
K = int(eval(input()))

if K % 2 == 0:
    print((-1))
elif K % 5 == 0:
    print((-1))
else:
    seven = 7
    ans = 1
    while ans < 1000000:
        amari = seven % K
        if amari == 0:
            print(ans)
            break
        else:
            ans += 1
            seven = amari * 10 + 7
    else:
        print((-1))

# Optimized solution
K = int(eval(input()))

if K%2 == 0 or K%5 == 0:
    print((-1))
else:
    if K%7 == 0:
        L = 9*K//7
    else:
        L = 9*K
    i = 1
    A = 10
    while i < 9000000:
        re = A%L
        if re == 1:
            print(i)
            break
        else:
            A = re*10
            i += 1
    else:
        print((-1))
# Original solution
K = int(eval(input()))
n = 0
for i in range(1, 1010101):
    n = (n*10 + 7) % K
    if n == 0:
        print(i)
        exit()
else:
    print((-1))

# Optimized solution
K = int(eval(input()))
n = 0
for i in range(1, 1000000):
    n = (n*10 + 7) % K
    if n == 0:
        print(i)
        exit()
else:
    print((-1))
# Original solution
k = int(eval(input()))
if k % 2 == 0 & k % 5 == 0:
    print((-1))
    exit()

x = 7 % k
s = set()
i = 1
ans = -1
while x not in s:
    if x == 0:
        ans = i
        break
    s.add(x)
    x = (10 * x + 7) % k
    i += 1
    
print(ans)

# Optimized solution
k = int(eval(input()))
if k % 2 == 0 & k % 5 == 0:
    print((-1))
    exit()

x = 7 % k
s = set()
ans = -1
for i in range(1,k+1):
    if x == 0:
        ans = i
        break
    s.add(x)
    x = (10 * x + 7) % k
    i += 1

print(ans)
# Original solution
def c_repsept():
    K = int(eval(input()))

    if (K % 2 == 0 or K % 5 == 0):
        return -1  # repsept の因数に 2, 5 はない

    repsept = 7 % K
    count = 1
    while repsept % K !=0:
        repsept = ((repsept * 10) + 7) % K
        count += 1
    return count

print((c_repsept()))

# Optimized solution
def c_repsept():
    K = int(eval(input()))

    L = 9 * K // 7 if K % 7 == 0 else 9 * K
    if L % 2 == 0 or L % 5 == 0:
        return -1

    remainder = 1
    for n in range(1, L + 1):
        remainder = (10 * remainder) % L
        if remainder == 1:
            return n
    return -1

print((c_repsept()))
# Original solution
def c_repsept():
    K = int(eval(input()))

    L = 9 * K // 7 if K % 7 == 0 else 9 * K
    if L % 2 == 0 or L % 5 == 0:
        return -1

    remainder = 1
    for n in range(1, L + 1):
        remainder = (10 * remainder) % L
        if remainder == 1:
            return n
    return -1

print((c_repsept()))

# Optimized solution
def c_repsept_totient():
    def euler_phi(n):
        """正整数 n に対して、n と互いに素な n 以下の正整数の個数"""
        ret = n
        for i in range(2, int(n**0.5) + 1):
            if n % i == 0:
                ret = ret // i * (i - 1)
                while n % i == 0:
                    n //= i
        if n > 1:
            ret -= ret // n
        return ret

    def divisor_list(n):
        """n の正の約数のリスト"""
        ret = set()
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.update({k, n // k})
        return sorted(ret)

    K = int(eval(input()))
    L = 9 * (K // 7 if K % 7 == 0 else K)

    for d in divisor_list(euler_phi(L)):
        if pow(10, d, L) == 1:
            return d
    return -1

print((c_repsept_totient()))
# Original solution
K = int(eval(input()))
ans = -1
if K in [2,5]:
    pass
else:
    num = 7
    ans = 0
    while True:
        ans += 1
        if num % K == 0:
            break
        else:
            num = (num * 10 + 7)%K
print(ans)

# Optimized solution
K = int(eval(input()))
ans = -1
if K%2 == 0:
    pass
elif K%5 == 0:
    pass
else:
    num = 7
    ans = 0
    while True:
        ans += 1
        if num % K == 0:
            break
        else:
            num = (num * 10 + 7)%K
print(ans)