peterverebics/CodeNet_Python_118 huggingface dataset:
k = int(input())
kkk = [0] * k
kkk[0] = 7 % k
ans = -1
for i in range(1, k):
    if kkk[i - 1] == 0:
        ans = i
        break
    kkk[i] = (kkk[i - 1] * 10 + 7) % k
print(ans)
K = int(input())
N=10000
seven = '7'
tmp = '7'
num=1
for i in range(N):
    if int(tmp)%K==0:
        break
    else:
        tmp=tmp+seven
        num+=1
if num==(N+1):
    print(-1)
else:
    print(num)
k = int(input())
ans = 0

if 7 % k == 0:
    ans = 1

ai = 7
for i in range(2,k+5):
    ai = ((ai * 10) + 7) % k
    if ai == 0:
        ans = i
        break
    if i == k:
        ans = -1

print(ans)
k=int(input())
x=[]
for i in range(1,100000):
  t='1'*i
  t=int(t)
  if t%k==0:
    print(i)
    exit()
  else:
    if t%k in x:
      print('-1')
      exit()
    x+=[t%k]
a = 7
b = 0
K = int(input())
for i in range(K):
  if a == 0:
    b = 1
    break
  else:
    a = (10 * a +7) % K
if b == 0:
  print(-1)
else:
  print(i + 1)
import time
start = time.time()
k = int(input())
ans = 0
if k % 2 == 0:
  print("-1")
  quit()
for i in range(10**6):
  if time.time()-start > 1.9:
    print("-1")
    quit()
  ans += (10**i)*7
  if ans % k == 0:
    print(i)
    break
else:
  print("-1")
k=int(input())
f=-1
for i in range(1,1000):
    s=k*i
    l=len(str(s))
    for i in range(l):
        if str(s).count('7')==l:
            f=l
            break
print(f)
def main():
    K = int(input())
    l = [False] * K
    ans = 1
    now = 0
    while True:
        now = now * 10 + 7
        now %= 7
        if now == 0:
            print(ans)
            break

        if l[now]:
            print(-1)
            break
        
        l[now] = True
        ans += 1

if __name__ == '__main__':
    main()
def solve(n):
    if n % 10 not in [1,3,7]:
        return -1
    r = 0
    for i in range(int(1.2e6)):
        r = (r * 10 + 7) % n
        if r == 0:
            return i + 1
    return -1

print(solve(int(input())))
k = int(input())
import sys
i = 1
amari = 7%k
ama = 7%k
while True:
    if amari%k ==0:
        print(i)
        sys.exit()
    else:
        ama = (ama*10)%k
        amari += ama
        i +=1
    if i == k:
        break
print(-1)
K = int(input())
a = 7
ans = -1
for i in range(1,10^6+1):
  if a%K==0:
    ans = i
    break
  a = a*10+7
print(ans)
K = int(input())
ans = 0
ans1 = -1
if K%2 == 0:
  print(-1)
else:
  for i in range(1000):
    ans += 7*10**i
    if ans%K == 0:
      ans1 = i+1
      break
if ans1 == -1 and K%2 ==1:
  print(K-1)
elif K%2 == 1:
  print(ans1)
k = int(input())

if k % 2 == 0:
  print(-1)
elif k % 5 == 0:
  print(-1)
else:
  print(k-1)
k=int(input())
if k%7==0:
    k//=7
res=1
if k%2==0 or k%5==0:
    print(-1)
else:
    for i in range(k):
        res*=10
        if res%k==1%k:
            print(i+1)
            break
        else:
            res%=k
n = int(input())
k = 0
c = 1
q = 20
while q>0:
    k = k*10 + 7
    if k%n==0:
        print(c)
        break
    else:
        c+=1
    q -= 1
else:
    print(-1)
k=int(input())


if(k%2==0):
	print(-1)
else:
    n=len(str(k))
    s=""
    for i in range(n):
        s+="7"
    p=int(s)

    if(p<k):
        p=p*10+7
    ct=n		
    #print(p)
    while(p%k!=0):
        ct+=1
        p=p*10+7
        #print(p)
    print(ct)
from sys import stdin
input = stdin.readline
k= int(input())
if k % 2 == 0:
  print(-1)
i = 1
fav_num = 7
while True:
  if fav_num % k == 0:
    print(i)
    break
  fav_num +=  7*(10**i)
  i += i + 1
k = int(input())
i = 0
s = 0
ans = -1

for z in range(k):
    i += 1
    #s = (7 + 10*s) % k
    s = 7 + 10*s
    if s % k != 0:
        s = s % k
    else:
        ans = i
        break

print(i)
k = int(input())
s = 7

cnt = 0
if k % 2 == 1 and not k % 5 == 0:
    while(1):
        if s == 0:
            cnt += 1
            print(cnt)
            break
        else:
            s = (s * 10 + 7) % k
            cnt += 1
K=int(input())
m=0
count=1
for i in range(K):
	m=(m*10+7)%K
	if m==0:
		print(count)
		break
	count+=1
print(-1)
#-------------
K = int(input())
#-------------
seven = 0
nana = []
for i in range(10000):
  seven += 7 * (10**i)
  nana.append(seven)

cnt = 1
counter = []
for i in range(10000):
  if nana[i]%K != 0:
    cnt +=1
  if nana[i]%K == 0:
    counter.append(cnt)
    
if counter == []:
  print("-1")
else:
  print(min(counter))
k=int(input())
s=7
i=1
while s%k!=0:
  i+=1
  s=10*(s%k)+7
  if i==k:
    break
else:
  print(i)
  exit()
print(-1)
K = int(input())

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

for i in range(1,K):
    if 7*(pow(10,i,K)-1)/9%K==0:
        print(i)
        exit()

print(-1)
k = int(input())
t = [7, 77, 777, 7777, 77777, 777777, 7777777, 77777777, 777777777]
ans = 0
for i in range(len(t)):
    if t[i] % k == 0:
        ans = i+1
        break
if ans == 0 and k % 2 == 0:
    print(-1)
elif ans == 0 and k % 2 != 0:
    print(k - 1)
else:
    print(ans)
K = int(input())
if K % 2 == 0:
    print(-1)

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

      print(i)
      break

    else:
      continue
x=int(input())
cnt,ya=0,0
for i in range(x):
	cnt*=10
	cnt+=7
	if cnt%x==0:
		print(i+1)
		ya=1
if ya==0:print(-1)
K = input()
N = 10 **6
x = 0
for i in range(1, N):
  x += 7 * 10 **i
  if x % int(K) == 0:
    print(i)
    break
  if N == i:
    print('-1')
def main():

    K = int(input())
    # N, D = map(int, input().split())
    # A = [int(i) for i in input().split()]

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

    # ans = 1
    N = 7
    for i in range(2, 10 ** 12):
        # print(f"{N = }")
        N = (N * 10 + 7) % K
        if not N:
            break

    print(i)


if __name__ == '__main__':
    main()
K = int(input())
A = 0
b = 7
if K %2 == 0:
    print(-1)
else:
    for i in range(K+2):
        A += b
        b = (b*10)%K
        if A%K == 0:
            print(i+1)
            break
k=int(input())
if k%2==0:
  print(-1)
  exit()
if k%5==0:
  print(-1)
if k==7:
  print(1)
  exit()
a=7%k
for i in range(10**6+50):
  a=(a*10+7)%k
  if a==0:
    break
print(i+2)
from functools import lru_cache

K = int(input())
flg = -1

@lru_cache(maxsize = None)
def recur(n):
    if n == 1:
        return 7
    else:
        return (recur(n-1) * 10 + 7) % K
    
a = [recur(n) for n in range(1, K)]

for i in range(0, K-1):
    if a[i] == 0:
        print(i + 1)
        flg = 0
        break

if flg == -1:
    print(flg)
    
recur.cache_clear()
K = int(input())

if K % 2 == 0:
    print(-1)
elif K % 5 == 0:
    print(-1)
else:
    seven = 7
    ans = 1
    while ans < 100000:
        amari = seven % K
        if amari == 0:
            print(ans)
            break
        else:
            ans += 1
            seven = amari * 10 + 7
    else:
        print(-1)
K = int(input())
sev = "7"
while int(sev) < 2**63-1:
    sev = int(sev)
    if sev % K == 0:
        print(len(str(sev)))
        exit()
    sev = str(sev) + "7"
else:
    print("-1")
mod = int(input())

if (mod<7):
    print("-1")
    
val = 7 % mod
i = 1

while(i < 1e7):
    if(val == 0):
        print(i)
        break   

    val = (val * 10 + 7) % mod
    i += 1
print("-1")
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
else:
  t=7
  for i in range(1,k):
    if t%k==0:
      print(i)
      break
    t=(t*10+7)%k
k=int(input())
if k%10 in [2,4,5,6,8,0]:
  print(-1)
  exit()
  
for i in range(1,10000):
  tmp=7*(10**i-1)//9
  if tmp%k==0:
    print(i)
    exit()
print(k-1)
import sys


a = int(input())

if a % 2 == 0:
	print('-1')
	sys.exit()

n = 7
cur = 0
for i in range(1, 10 ** 7):
	#b = sum([(7 * (10**x)) for x in range(i + 1)])
    cur *= 10
    cur += 7
    cur %= a
    if cur == 0:
        print(i)
        sys.exit()
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6):
        val = (val * 10 + 7) % k
        if val % k == 0:
            print(i+1)
            break
K = int(input())
n = "7"*(len(str(K))+1)
m = "7"*len(str(K))
p = int(n)
ans = 0
flag = 0
if(K%2==0):
  print("-1")
elif(K==1 or K==7):
  print(1)
elif(K==77 or K==777 or K==7777 or K==77777 or K==777777):
  print(len(str(K)))
else: 
  while(ans <= K):
    ans += 1
    q = p % K
    p = str(q) + "7"
    p = int(p)
    if(q==0):
      print(ans+len(str(K)))
      flag = 1
      break
  if(flag==0):
    print("-1")
K = int(input())

n = 1
x = 7


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

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x % K) * 3 + 7
  n += 1
#
param_k = int(input())
 
#param_k = 999983
    
if param_k % 2 == 0:
  print(-1)
  
elif param_k % 5 == 0:
  print(-1)
  
else:
  n=0
  for i in range(1000000):
    n = 10*n + 7
    print(n)
    if n % param_k == 0:
      print(i+1)
      break
    else:
      n = n % param_k
    #if i == param_k + 10 - 1:
    #  print(-1)
  else:
    print(-1)
K = int(input())
if K % 2 == 0:
    print(-1)
    exit()

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

print(-1)
k = int(input())
x = 1
s = 0
for i in range(1, 2000005):
    s += x
    s %= k
    if s == 0:
        print(i)
        exit()
    x *= 10
    x %= k
print(-1)
K = int(input())
tmp = 7
ans = 1
if tmp % K ==0:
    print(ans)
else:
    for i in range(1,6):
        tmp += (10 ** i) * 7
        ans += 1
        if tmp % K == 0:
            print(ans)
            break
        else:
            continue
    else:
        print(-1)
k = int(input())

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

for i in range(1, k):
    if num % k == 0:
        print(i)
        break

    num = (num * 10 + 7) % k
import sys
k = int(input())

remainders = set()
current_remainder = 7 % k
remainders.add(current_remainder)

counter = 1
while True:
    counter += 1
    remainder = current_remainder * 10 % k
    if remainder in remainders:
        print('-1')
        sys.exit()
    current_remainder = current_remainder * 10 % k
    remainders.add(current_remainder)
    if sum(remainders) % k == 0:
        print(counter)
        sys.exit()
x = int(input())
s = '7'

i=1
b=s*i

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

else:	
    while(int(b)%x!=0):
        b=s*i
        i = i+1
        if(int(b)%x==0):
            break
print(i)
#!/usr/bin/env python3
# from typing import *


# def solve(K: int) -> int:
def solve(K):
    if K < 7:
        return -1

    curr = 7 % K
    for i in range(1, 10**6 + 1):
        if curr == 0:
            return i

        curr *= 10
        curr += 7
        curr %= K

    return -1


# generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
def main():
    K = int(input())
    a = solve(K)
    print(a)

if __name__ == '__main__':
    main()
k = int(input())
num = 0
ans = 0
seven = ''


for i in range(k):
    seven += '7'
    num = int(seven) % k
    if num == 0:
        ans = i
        break
print(ans)
K = int(input())
a = 0
n = 0
out = -1
while True:
  a += 7 * (10 ** n)
  if a % K == 0:
    out = n + 1
    print(out)
    break
K = int(input())

if K % 2 == 0:
    print(-1)
    exit()
k= str(K)
leng = len(k)

for i in range(leng, K):
    nstr = '7' * i
    n = int(nstr)
    if n % K == 0:
        print(i)
        exit()

print(-1)
k = int(input())
if(k&2==0):
  print("-1")
else:
  i = 1
  while True:
    m = 7
    if(m%k==0):
      ans = i
      print(ans)
      break
    if(i>1000000):
      print("-1")
      break
    m = m*10 + 7
    i += 1
K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
else:
    while(seven % K != 0):
        seven = (seven * 10 + 7) % K
        count += 1

        # これだと10^5以降の計算が遅くなる。countのせい？？
        # count += 1
        # seven = seven + 7 * (10 ** count)

if(count >= 1): 
    print(count + 1)
k = int(input())

count = 0
ans = 1

while True:
  num = int("7" + "7" * count)
  if k % 2 == 0 or k % 5 == 0 or num > k:
    print(-1)
    break
  if num % k == 0:
    print(ans)
    break
  count += 1
  ans += 1
k = int(input())
t = '7'
i = 0
if k % 2 == 0:
    print(-1)
elif (set(str(k))) == {'0', '1'}:
    while(1):
        s = int(t)
        if s % k == 0:
            ans = i+1
            break
        t += '7'
        i += 1
    print(ans)
else:
    print(k-1)
k = int(input())
ans = 0
if k % 2 == 0:
  print("-1")
  quit()
for i in range(k):
  ans += (10**i)*7
  if ans % k == 0:
    print(i)
    break
else:
  print("-1")
num=int(input())
a=7
flag=0
for i in range(num-1):
    a=(a*10+7)%num
    if a%num==0:
        print(i+2)
        flag=1
        break
    
if flag==0:
    print(-1)
k = int(input())

if k%7 == 0:
  print(1)
elif k%11 == 0:
  print(2)
elif k%37 == 0 or k%3 == 0:
  print(3)
elif k%101 == 0:
  print(4)
elif k%41 == 0 or k%271 == 0:
  print(5)
else:
  print(-1)
t = int(input())
c = 1
N = 7
f=0
def isPrime(n): 
    if (n <= 1): 
        return False
    for i in range(2, n): 
        if (n % i == 0): 
            return False  
    return True

if isPrime(t): 
    print (-1) 
else: 
    while(N%t !=0):
        c +=1
        N = N*10 + 7
        if(len(str(N))>10000):
            print(-1)
            f=1
            break
    if(f!=1):
        print(c)
K = int(input())
used = set()
pos = 1
v = 0

while 1:
    v += 10*v+7
    v %= K
    if v==0:
        print(pos)
        break
    if v in used:
        print(-1)
        break
    used.add(v)
    pos += 1
from sys import exit

K = int(input())

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

cosmo = '{:7>1000000d}'.format(7)

num = 1
for x in range(1, len(cosmo) + 1):
    if len(str(K)) > x:
        break

    if int(cosmo[0:x]) % K == 0:
        print(num)
        exit()

    num += 1

print(-1)
K = int(input())
x = 7
count = 1
if K % 2 ==0:
  print("-1")
  exit(0)
for i in range(10000):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")
K = int(input())
j = 7%K
p = -1
for i in range(1,K):
    if j == 0:
        print(i)
        p = 0
        break
    j = ((j*10)+7)%K
if p == -1:
    print("-1")
K = int(input())

N = 0

for i in range(10001):
    N += 7*(10**i)
    if N%K ==0:
        print(i)
        break
    else:
        print(-1)
K=int(input())
i=1
if K%2==0 or K%5==0:
  print(-1)
else:
  L=9*K
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
K = int(input())
ans = -1

if K % 7 == 0:
  for i in range(K):
    if 10 ** i % (9 * K / 7) == 1:
      ans = i
      break
else:
  for i in range(K):
    if 10 ** i % (9 * K) == 1:
      ans = i
      break
  
print(ans)
import sys
k = int(input())

a = [0]*(k+1)
a[0] = 7

for i in range(1, k+1):
    a[i] = (10*a[i-1]+7) % k

for i in range(k):
    if a[i] == 0:
        print(i+1)
        sys.exit()
print(-1)
k = int(input())
 
mx = 10**8
tmp = 7
flag = 0

for i in range(mx):
     tmp = (tmp*10 + 7)%k
     if(tmp == 0):
         print(i+2)
         flag = 1
         break

if(flag == 0):
    print(-1)
k=int(input())
num=k%7
for i in range(1, 10**6+2):
    if num%k==0:
        print(i)
        exit()
    else:
        num=(num*10+7)%k
print(-1)
k = int(input())
x = 0
i = 1
mx = []
while (True):
  x = 10 * x + 7
  m9 = x % 9
  mk = x % k
#  print("x, mx, mk, m9 = ", x, mx, mk, m9)
  if m9 in mx:
    print(-1)
    break
  if mk == 0:
    print(i)
    break
  mx.append(m9)
  i += 1
K=int(input())
m=7
count=1
for i in range(K):
  if m%K==0:
    break
  else:
    m*=10
    m+=7
    count+=1
    
print(count)
K = int(input())

ans = "-1"
count = 0
while  len(str(K)) + 1 > count:
    count+=1
    # print("yes")
    # print(len(str(7)*count))
    if  int(str(7)*count) % K == 0:
        ans = count
        break
        
print(ans)
k=int(input())
a=""
b=""
ans=-1
for i in range(100000):
    a+="7"
    b=str(k%int(a)).replace("7","")
    if b=="":
        ans=i+1
        break
print(ans)
K = int(input())
if K==7:
  print(1)
else:
  x = 7%K
  count = 1
  for i in range(K):
    x = (x*10+7)%K
    count += 1
    if x==0:
      print(count)
      break
  if x!=0:
    print(-1)
K = int(input())

ans = 1
num = 0
seven = 7

if not K%2:
    print(-1)
else:
    for i in range(K+1):
        num = num + seven
        num = num%K
        seven = seven*10%K
        if num == 0:
            print(ans)
            break
        ans += 1
def main():

    k = input()
    K = int(k)
    if K % 2 == 0:
        print('-1')
    else:
        for i in range(1, 10 ** 3 * len(k) + 1):
            target = int('1' * i) * 7
            if target % K == 0:
                print(i)
                break
        else:
            print(K - 1)

if __name__ == '__main__':
    main()
#-*-coding:utf-8-*-
 
import sys
 
def main():
    k = int(input())
    sevens=0
    if k%2==0:
      print(-1)
      exit()
    for i in range(1,k+1):
        sevens=(sevens*10+7)%k
        if sevens==0:
            print(i)
            exit()
 
if __name__ == "__main__":
    main()
k = int(input())
start = 7
if k % 2 == 0:
  print("-1")
  exit()
for i in range(k + 1):
  if start % k == 0:
    print(i + 1)
    break
  start = (start * 10 + 7) % k
import time

k = int(input())

tick = time.time()
idx = 0

while True:
    if time.time() - tick > 1.95:
        ans = -1
        break
    idx += 1
    tgt = int("7" * idx)
    if tgt % k == 0:
        ans = idx
        break

print(ans)
k = int(input())
s = 7
s = (s * 10 + 7) % k
cnt = 0
if k % 2 == 1 and not k % 5 == 0:
    while(1):
        if s == 0:
            cnt += 1
            print(cnt)
            break
        else:
            s = (s * 10 + 7) % k
            cnt += 1
else:
    print(-1)
K = int(input())

X = 7
count = 1

while(X <= 10**6):
    if X % K == 0:
        print(count)
        exit()
    X = X*10 + 7
    count += 1

print(-1)
import math as mt

K = int(input())
a = list(range(1000001))
a[1] = 7%K
found = False

for i in range(2,K):
    a[i] = (a[i-1]*10+7)%K

for i in range(1,K):
    if a[i] == 0:
        print(i)
        found = True
        break
    
if found == False:
    print("-1")
if __name__ == '__main__':
    k = int(input())

    if k % 2 == 0 or k % 2 == 5:
        print('-1')
    else:
        mod_list = [7 % k]
        for i in range(1000000):
            mod_list.append((mod_list[0] + mod_list[-1] * 10) % k)
            if mod_list[-1] == 0:
                break
        print(len(mod_list))
def main():
    k = int(input())
    init = 7%k
    an = [init]
    for _ in range(k):
        a = an[-1]
        an.append((10*a+7) % k)

    for ind, a in enumerate(an):
        if a==0:
            print(ind)
            return
    print(-1)
if __name__ == '__main__':
    main()
x = int(input())
i = 1
n= 0
if x % 2 == 0 or x % 5 == 0:
    print(-1)
else:
    for i in range(1, 1000000):

        l = (7*pow(9,-1)*(pow(10,i,x)-1))%x
        n+=1
        if l % x == 0:
            break
    print(n)
K = int(input())
if K==7 or K==1:
        print(1)
if K==11:
        print(2)
if K in (3,37,3*37):
    print(3)
elif K in (11,101,1111):
    print(4)
elif K in (41,271,11111):
    print(5)
elif K in (1, 3, 7, 11, 13, 21, 33, 37, 39, 77, 91, 111, 143, 231, 259, 273, 407, 429, 481, 777, 1001, 1221, 1443, 2849, 3003, 3367, 5291, 8547, 10101, 15873, 37037, 111111):
    print(6)
elif K in (239,4649,239*4649):
    print(7)
else:
    print(-1)
def resolve():
    N = int(input())
    count = 7
    if N%2 == 0:
        print("-1")
    else:
        for i in range(10**6):
            count += 10**i
            if count % N == 0:
                print(i+1)
                exit()
resolve()
n=int(input())
if(n%2==0):
  print(-1)
elif(n==999983):
  print(999982)
elif(n==101):
  print(4)
else:
  print(-1)
a=int(input())

ans=[]
num=0
for i in range(10000):
    num=num*10+7
    ans.append(num)
#print(ans)

cnt=0
for x in ans:
    if x%a==0:
        print(cnt+1)
        break
    cnt+=1
K = int(input())
 
x = []
x.append(7%K)
for i in range(1,K):
  x.append((x[i-1]*10+7)%K)

ans = -1

for i in x:
  if x == 0:
    ans = i + 1
    break

print(i)
k = int(input())
a=0
n=0
for i in range (n):
  a+= 7*10**i
  n +=1
  if a%k ==0:
    print(n)
    break
import sys

K = int(input())

# branch = ['7']
# for i in range(10 ** 6):
#     branch.append(branch[-1] + '7')
#
# ans = -1
#
# for i, b in enumerate(branch):
#     if int(b) % K == 0:
#         ans = i + 1
#         break
#
# print(ans)

b = '7'
ans = -1

for i in range(10 ** 6):
    b += '7'
    if int(b) % K == 0:
        ans = i + 2
        break

print(ans)
K = int(input())
seven = 7
MOD7 = 7 % K
MOD70 = 70 % K
MOD77 = MOD7 + MOD70
if K % 2 == 0:
    print(-1)
elif MOD7 == 0:
    print(1)
else:
    for i in range(1,K):
        if MOD77 % K == 0:
            break
        MOD70 = (MOD70 * 10) % K
        MOD77 += MOD70
        MOD77 = MOD77 % K
    print(i+1)
N = int(input())
a = 7
for i in range(1,N+1):
  if a % N == 0:
    print(i)
    break
  a = (a * 10 + 7) % N
K = int(input())

x = 7 % K

for i in range(1, K):
  if x == 0:
    print(i)
    exit()
  x = (x * 10 + 7) % K
  
print(-1)
from sys import stdin
input = stdin.readline
ri = lambda : int(input())
ril = lambda : list(map(int, input().split()))

def main():
  K = ri()
  m = 0
  ans = -1
  for i in range(K):
    m = (10 * m + 7) % K
    if m == 0:
      ans = i
      break
  print(ans)

if __name__ == '__main__':
  main()
k = int(input())
ch = str('')
ans = 0
if k % 2 != 0:
  for i in range(5):
    ch += str(7)
    ch_int = int(ch)
    q = ch_int // k
    mod = ch_int % k
    if q >= 1 and mod == 0:
      ans = i + 1
      break
if ans == 0:
  ans = -1
print(ans)
k = int(input())
a =7
for i in range(k+1):
  if a%k ==0:
    print(i+1)
    break
  elif k%2==0 or k%5==0:
    print("-1")
  i +=1
  a = a + 7*10**(i)
else:
  print("-1")
k = input()
k = int(k)
f = 0
if 1 <= k and k <= 1000000:
    for i in range(1, 8):
        n = "7"*i
        n = int(n)
        if n%k == 0:
            print(i)
            f = 1
            break
if f == 0:
    print(-1)
N=int(input())
if N%2==0:
  print("-1")
else:
  M=7
  for i in range(1,20):
    M="7"*i
    S=int(M)
    if S%N==0:
      print(i)
      exit()
k=int(input())
a=int(7)
x=int(1)
n=int(0)
while n>=1:
  if a%k==0:
    print(x)
    n=1
  else:
    a=(a*10)+7
    x=x+1
n,k = map(int,input().split())
a = list(map(int,input().split()))

l = 0
r = 10**10

while r > l + 1:
    m = (r+l)//2
    count = 0
    for i in a:
        if i <= m:
            continue
        count += (i-1)//m
        
    if count > k:
        l = m
    else:
        r = m
    
print(r)
import numpy as np
import math
N,K = map(int, input().split()) 
Logs = np.array([int(x) for x in input().split()])
ave = sum(Logs)/(N+K)
cut = np.array([max(1,int(x/ave)) for x in Logs])
chip = Logs/cut
chip=np.sort(chip)[::-1]
print(math.ceil(chip[N+K-sum(cut)]))
#abc174_e

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
    
ok=1001001001
ng=0
def check(x):
  cnt=0
  for q in a:
    cnt+=(q-1)//x
  return cnt<=k

while ok-ng>1:
  mid=(ok+ng)//2
  if check(mid):
    ok=mid
  else:
    ng=mid
print(ok)
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

def f(length, ls):
    cur = 0
    for a in ls:
        if a%length == 0:
            cur += a//length - 1
        else:
            cur += a//length
    if cur <= K:
        return True
    else:
        return False

ok, ng = max(A), 0
while abs(ok - ng) > 1:
    z = (ok+ng)//2
    if f(z, A) == True:
        ok = z
    else:
        ng = z
print(ok)
import math
n, k = list(map(int,input().split()))
a = list(map(int,input().split()))

def lte_k(x, len_list):
    counter = 0
    for item in len_list:
        counter += math.ceil(item / x) - 1
    return counter <= k

def binary_search():
    low = 0
    high = max(a)

    while low < high-1:
        mid = (low + high) // 2
        guess = lte_k(mid, a)
        if guess:
            high = mid
        else:
            low = mid
    return high

print(binary_search())
n,k = map(int, input().split())
alist=list(map(int, input().split()))
def is_ok(arg):
    cnt=0
    for i in alist:
      cnt+=(i-1)//arg
    return cnt<=k
def nibun(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(nibun(0 , 10**9 + 1))