peterverebics/CodeNet_Python_118 huggingface dataset:
K = int(input())
md = 0
if K % 2 == 0:
    print(-1)
    exit()
for i in range(10 ** 6):
    a, b = divmod(md + 7 * (pow(10, i, K)), K)
    if b == 0:
        print(i + 1)
        exit()
    else:
        md = b
print(-1)
K = int(input())

mod = 7 % K
for i in range(K):
    if mod == 0:
        print(i+1)
        exit()

    mod = (10*mod + 7) % K

if mod == 0:
    print(K)
else:
    print(-1)
K = int(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)
k = int(input())

if k in [2, 5, 10] == 0:
    print(-1)
    exit()

n_map = {}
current = 7 % k
cnt = 1
while True:
    if current == 0:
        print(cnt)
        exit()
    if current in n_map:
        print(-1)
        exit()
    else:
        n_map[current] = True
    cnt += 1

    current = 10 % k * current + 7
    current %= k
K = int(input())
r = 7
ans = 1
s = set([])
while True:
    r %= K
    if r == 0:
        print(ans)
        break
    if r in s:
        print(-1)
        break
    s.add(r)
    r *= 10
    r += 7
    ans += 1
K = int(input())

cnt = set()
k = 7%K
i = 1

while k not in cnt:
  if k == 0:
    print(i)
    exit()

  cnt.add(k)
  k = (10*k+7) % K
  i += 1

print(-1)
# -*- coding: utf-8 -*-
k = int(input())
ans = 0
n = 7

if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit(0)
c = 1
while True:
    if n % k == 0:
        break
    n = (n * 10 + 7) % k
    c += 1

print(c)
K = int(input())
L = 0
if K % 7 == 0:
  L = 9*K//7
else:
  L = 9*K
  
t = 1
ans = -1
for i in range(1,L,1):
  t = t*10
  if t % L == 1:
    ans = i
    break
  t = t % L
print(ans)
s, k = '', int(input())
for i in range(k):
    s += '7'
    s = str(int(s)%k)
    if not int(s): print(i+1); break
else: print(-1)
k = int(input())

s = 0
c = 1

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

if c > i+1:
    print('-1')
else:
    print(c)
k = int(input())

m = 0
for i in range(k):
    m = (m*10 + 7)%k
    if m == 0:
        ans = i + 1
        break

if m == 0:
    print(ans)
else:
    print(-1)
#-*-coding:utf-8-*-
 
import sys
 
def main():
    k = int(input())
    sevens=0
    if k%2==0:
      print(-1)
      exit()
    for i in range(1,10**6+1):
        sevens=(sevens*10+7)%k
        if sevens==0:
            print(i)
            exit()
    print(-1)
 
if __name__ == "__main__":
    main()
k = int(input())
cur = 0
flag = False
for i in range(1, 10**6):
    cur *= 10
    cur += 7
    cur %= k
    if cur == 0:
        flag = True
        break
if flag:
    print(i)
else:
    print(-1)
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

K = ri()

if K % 2 == 0:
	print(-1)
	exit()
r = 0
for i in range(10000000):
	r = (r*10+7) % K
	if r == 0:
		print(i+1)
		exit()
print(-1)
K=int(input())
num=7
ans=-1
for n in range(pow(10,7)):
    if num%K==0:
        ans=n+1
        break
    shou=num//K
    num-=K*shou
    num=int(str(num)+'7')
print(ans)
#https://atcoder.jp/contests/abc174/tasks/abc174_c
K= int(input())

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B==0:
            print(i)
            break
        else:
            B = (10 * B + 7) % K
            i = i + 1
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


k = I()

m = k % 10
if m % 2 == 0 or m == 5:
    print(-1)
    exit()
if k == 1 or k == 7:
    print(1)
    exit()
else:
    rk = 7
    for i in range(2, 10 ** 6 + 1):
        rk1 = ((10 % k) * rk % k + 7 % k) % k
        if rk1 == 0:
            print(i)
            exit()
        rk = rk1
def resolve():
    k = int(input())
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

    print(-1)

resolve()
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    k = int(input())
    keta = 1
    mod = 7%k
    if k % 7 == 0:
        max_k = 9*k//7
    else:
        max_k = 9*k
    if k %2 == 0 or k%5 == 0:
        print(-1)
    while keta < max_k:
        if mod == 0:
            print(keta)
            break
        mod = (mod*10 + 7)%k
        keta += 1


if __name__=='__main__':
    main()
import sys

def main():
    K = int(sys.stdin.readline())
    
    if K%2==0:
        print(-1)
        return
    
    if K % 7:
        L = 9*K
    else:
        L = 9*K//7
    a = 1
    for i in range(1,L+1):
        a = (a * 10) % L
        if a == 1:
            print(i)
            return
    print(-1)
main()
k = int(input())
cur = 7
t = cur%k
flag = False
for i in range(1,k+1):
    if t == 0:
        print(i)
        flag = True
        break
    else:
        t = (10*t)%k
        t += 7
        t %= k
if not flag:
    print(-1)
def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
    else:
        a = 7
        if a % k == 0:
            print(1)
            exit()
        for i in range(2, k + 1):
            a = (10 * a + 7) % k
            if a % k == 0:
                print(i)
                exit()
        print(-1)





if __name__ == '__main__':
    main()
k = int(input())
t = 7
#kで割ったあまりは0を除けばk-1種類
for i in range(k):
    if t%k == 0:
        print(i+1)
        break
    t = (t*10+7)%k
else:
    print(-1)
K = int(input())

i = 0
n = 0
while True:
	n = (n * 10 + 7) % K
	i += 1
	if n % K == 0:
		print(i)
		break
	if i > 1000000:
		print(-1)
		break
n = int(input())
if n%7 == 0:
  n //= 7
r = 0
for i in range(n+1):
  r += pow(10,i,n)
  r %= n
  if r == 0:
    print(i+1)
    exit()
print(-1)
K = int(input())

s=0
i = 1
while i <=K:
    s = (s*10+7)%K
    if s==0:
        print(i)
        break
    i +=1
if i>K:
    print(-1)
k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    i = 1
    m = 7 % k
    while True:
        if m == 0:
            print(i)
            break
        m = (10 * m + 7) % k
        i += 1
K = int(input())
map = {0: True}
cnt = 1
nana = 7 % K
md = 7 % K
while md not in map:
# for i in range(100):
    cnt += 1
    map[md] = True
    md = (10 * md + nana) % K
    # print(md)
if md == 0:
    print(cnt)
else:
    print("-1")
K = int(input())
cur = 0
for i in range(1, K + 1):
    cur = (cur * 10 + 7) % K
    if cur == 0:
        print(i)
        exit(0)
print(-1)
import itertools

k = int(input())

mod = set()
seven = 7 % k

for i in itertools.count():
  if seven == 0:
    print(i+1)
    break;
  elif seven in mod:
    print(-1)
    break;
  mod.add(seven)
  seven = (seven*10+7) % k
k=int(input())
x=i=0
while i<k:i+=1;x=(x*10+7)%k;x<1>exit(print(i))
print(-1)
K=int(input())
if K%2==0 or K%5==0:
  print("-1")
else:
  ans = 1
  s = 7
  while True:
    if s%K==0:
      print(ans)
      break
    else:
      s=(s%K)*10+7
      ans += 1
k = int(input())

rem = 0
for i in range(k):
    rem = rem*10 + 7
    rem %= k
    if rem==0:
        break

if i==(k-1):
    print(-1)
else:
    print(i+1)
k=int(input())
c=0
x=0
for c in range(7):
  x=x+7*10**c
  if x%k==0:
    print(c+1)
    break
  elif c==6:
    print(-1)
    break
k=int(input())
sevs=7
for x in range(1,k+1):
  if sevs%k==0:
    print(x)
    exit()
  else:
    sev=(10*sevs+7)%k
print('-1')
# your code goes here
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 %x*pow(9,-1)%x* (pow(10,i,x) - 1%x)%x )%x
        #l=math.ceil(l)
        
        n+=1
        
        if l % x == 0:
            break
    print(n)
k = int(input())
if(k%2==0):
  print("-1")
else:
  i = 1
  while True:
    m = 7
    if(m%k==0):
      print(i)
      break
    if(i>10000000):
      print("-1")
      break
    m = m*10 + 7
    i += 1
import sys
k = int(input())
if k % 7 == 0:
    k = k // 7
tmp = 1
for i in range(k+2):
    if tmp == 0:
        print(i+1)
        sys.exit()
    tmp = (tmp * 10 + 1) % k
print(-1)
k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
elif k == (1 or 7):
    print(1)
else:
    t = 2
    ex = 77
    for i in range(10 ** 8):
        if ex % k == 0:
            break
        ex = (ex % k) * 10 + 7
        t += 1
    print(t)
k = int(input())
n = 0
for i in range(1, k+1):
    n = (n * 10 + 7) % k
    if n == 0:
        print(i)
        break
k = int(input())
a = 7
for i in range(1, k):
    if a % k == 0:
        print(i)
        exit()
    a = (10 * a + 7) % k
print(-1)
k = int(input())
answer = -1
cou = 7
for i in range(k):
	if cou%k == 0:
		answer = cou
	else:
		cou*10 + 7
print(answer)
ip = int(input())

ans = 7

for i in range(1,8):
    if int(ans) % ip == 0:
        print(i)
        break
    else:
        ans = int(ans) * 10 + 7
        i += 1
n = int(input())

ans,c = 0,0

while 1:
    c+=1
    f=0
    for i in range(10):
        if ((ans%10)+((n%10)*i)%10)%10==1:
            ans += n*i
            #print(ans,i)
            f=1
            break
    if f==0:
        print(-1)
        exit()
    ans = ans//10
    if ans==0:
        break
print(c)
k = int(input())
mod = 0
for i in range(1, k):
    mod = ((mod * 10) + 7) % 7
    if mod == 0:
        print(i)
        exit()
print(-1)
k = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

sevn = "7"
i = 1
for i in range(1,10**4+1):
    tmp = int(sevn)
    if tmp%k==0:
        print(i)
        exit()
    sevn += "7"
    #i += 1

print(-1)
import io
import sys

_INPUT = """\
999983
"""
sys.stdin = io.StringIO(_INPUT)

K = int(input())

x = 7 % K
s = set()
count = 0
while(True):
    count += 1
    if x in s:
        print(-1)
        break
    else:
        s.add(x)
        if x == 0:
            print(count)
            break
        x = (10*x+7) % K
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
if even(n):
    print(-1)
    exit()
s = "7"
count = 1
while True:
    if int(s) <= n:
        s = s+"7"
        count += 1
        continue
    else:
        res = int(s)%n
        if res == 0:
            print(count)
            exit()
        s = str(int(s)%n)
k = int(input())

if k % 2 == 0:
    print(-1)
else:
    count= 1
    if k==7:
        print(1)
    else:
        now = 7%k
        while(1):
            count += 1
            now = (now*10) % k + 7 % k
            if now % k == 0:
                print(count)
                exit()
k = int(input())
answer = -1
cou = 7
for i in range(k+1):
	if cou%k == 0:
		answer = cou
	else:
		cou = cou*10 + 7
print(answer)
K = int(input())

v = 0
for i in range(1, K):
    v = (v * 10 + 7) % K
    if v == 0:
        print(i)
        exit(0)
print(-1)
def resolve():
    N = int(input())
    count = 7
    if N%2 == 0:
        print("-1")
    elif N%5 == 0:
        print("-1")
    else:
        for i in range(N):
            count += (10**i)*7
            if count % N == 0:
                print(i+1)
                exit()
resolve()
k = input()
flag = True
for i in k:
	if i != '7':
		flag = False
		break
if flag: print(len(k))
else:
	k = int(k)
	for i in range(1,k+1):
		a = pow(10,i,k) - 1
		if a%9 == 0:
			print(i)
			flag = True
			break
	if not flag: print("-1")
k = int(input())
if k % 2 == 0:
    print(-1)
if k % 7 == 0:
    k //= 7
x = 1
s = 0
for i in range(1, 1000005):
    s += x
    s %= k
    if s == 0:
        print(i)
        exit()
    x *= 10
    x %= k
k = int(input())
c = 0
a = [0]*(k+1)
a[0] = 7%k

if k%2 == 0 or k%5 == 0:
	print('-1')
elif 7%k == 0:
	print('1')
else:
	for i in range(1,k):
		c += 1
		a[i+1] = (10*a[i] + 7)%k
		if a[i+1] == 0:
			break
	print(c)
K = int(input())
mod = 0
# mod Kは、0,1,...,K-1　の高々K種類
# i=K+1 まで行くと鳩の巣原理よりmodが既出になり、以降ループ
# すなわちi=Kまで見れば十分
for i in range(1, K + 1):
    mod = (10 * mod + 7) % K
    if mod % K == 0:
        print(i)
        exit()
k = int(input())
if(k % 2 == 0):
  print(-1)
else:
  if(k % 7 == 0):
    print(1)
  else:
    a = 1
    amari = 7 % k
    while(a < k):
      a += 1
      amari = (amari*10 + 7) % k
      if(amari == 0):
        print(a)
        break
    if(a == k):
      print(-1)
k=int(input())
ans=-1
s="7"
cnt=1
if k%2!=0 and k%5!=0:
  if k%3!=0:
    ans=k-1
  else:
    while int(s)%k!=0:
      s+="7"
      cnt+=1
    ans=cnt
print(ans)
K = int(input())
a = 0
n = 0
out = -1
for _ in range(K):
  a += 7 * (10 ** n)
  if a % K == 0:
    out = n + 1
    break

print(out)
K = int(input())

num = 0
cnt = 0
ans = False

for i in range(K):
    num = num*10+7
    cnt += 1
    if num % K == 0:
        print(cnt)
        ans = True

if ans == False:
    print(-1)
a=int(input())
 
if a%2 == 0:
  print(-1)
else:
  ans = 1
  div = 0
  
  for i in range(10**6):
    div += 7*10**i
    if a%div == 0:
      break
    else:
      ans +=1
  
  print(ans)
# your code goes here
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, R, a = int(input()), 7, -1
for i in range(1, k+10):
    if not R:
        a = i
        break
    R = (R * 10 + 7) % k
print(a)
k=int(input())
a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,k):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)
k = int(input())
seven = 7
i = 1
if k % 2 == 0:
    print(-1)
else:
    while seven < k:
        seven = seven + 7 * 10**i
        i +=1
        ans = seven
        
    while seven % k != 0:
        seven = seven + 7 * 10**i
        i +=1
        if i >101:
            i = k-1
            break
    print(i)
import time
k = int(input())
n = 7
c = 1
t1 = time.time() 
t2 = time.time()
while (t2-t1) <= 1.8:
  if n%k == 0:
    print(c)
    break
  else:
    n = int(str(n)+"7")
    c+=1
    t2 = time.time()

if (t2-t1) > 1.8:
  print(-1)
K = int(input())
i = 0
ret = -1
if K % 5 != 0 and K % 2 != 0:
  N = 1
  if K % 7 == 0:
    L = K * 9 // 7
  else:
    L = K * 9
  while True:
    if N % L == 1:
      ret = i
      break
    N = (N * 10 )% L
    i += 1
print(ret)
#C - Repsept
K = input()
K = int(K)

def each_sum(n):#各桁の合計を求める
    s = str(n)
    allay = list(map(int,s))#文字列sを数値リストにして返す
    return(sum(allay)) 
def seven():
    seven_i = 0
    count = 0
    for i in range(1,K):
        seven_i = (7 * ((10**i) -1 )  // 9)
        seven_i %= K
        count += 1
        if seven_i % K == 0:
            return count
    return -1

print(seven())
k = int(input())
a = 0
for i in range(k-1):
    a = (a*10+7)%k
    if a == 0:
        print(i+1)
        break
else:
    print(-1)
# coding: utf-8
import numpy as np

k = int(input())

s = 0
cnt = 0
flg = False

while (cnt < 1e7):
    cnt += 1
    print(cnt)
    s = s * 10 + 7 
    # print(s)

    if s % k == 0:
        flg = True
        break

    if k < 7:
        flg = False
        break

    if k % 2 == 0:
        flg = False
        break


if flg == True:
    print(cnt)
else:
    print(-1)
k = int(input())

x = 7
e = 10

for i in range(10000000):
    # print(x)
    if x == 0:
        print(i + 1)
        exit()
    x = (x * e + 7) % k

print("-1")
K=int(input())

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

now=7
for i in range(k+10):
	if now%7==0:
		print(i+1)
		exit()
	now*=10
	now+=7
print(-1)
k=int(input())
s=[]
s.append(7%k)
for i in range(1,k):
    s.append((s[i-1]*10+7)%k)
    if s[i]==0:
        print(i+1)
        exit()
print(-1)
k, R = int(input()), 1
for i in range(1, k+10):
    if not R:
        print(i)
    R = (R * 10 % 7 + 7) % k
k=int(input())
f=-1
for i in range(1,1000):
    s=k*i
    l=len(str(s))
    d=0
    for i in range(l):
        if str(s)[i]!=7:
            d=d+1
            break
    if d<=0:
        f=l
print(f)
b = int(input())

list = [7]
for i in range(b):
    list.append(list[-1]*10 +7)

for l in range(b%10, len(list)):
    if list[l] % b == 0:
        print(b%10 + l)
        exit()
K = int(input())
cnt=len(str(K))

if K % 2 == 0:
    print(-1)
else:
    while True:
        n = int(cnt*str(1))
        if n % int(K) != 0:
            cnt+=1
        else:
            print(len(str(n)))
            break
k=int(input())
a=0
if k%2==0:
  print(-1)
else:
  for i in range(k):
    a=(a*10+7)%k
    if a==0:
      print(i+1)
      exit()
import sys
x = int(input())
if x%2 == 0:
    print(-1)
    sys.exit()
y = 7
i = 1
while y%x != 0:
    if i == 100:
        print(-1)
        sys.exit
    i = i + 1
    y = y*10 + 7
print(i)
k = int(input())
answer = -1
cou = 7
for i in range(k+1):
	if cou%k == 0:
		answer = cou
	else:
		cou*10 + 7
print(answer)
K=int(input())
n=1
an=[7%K]
bn=[10%K]
while True:
    an.append(an[-1]%K+(7%K)*(bn[-1]%K))
    if an[-1]%K==0:
        print(n+1)
        break
    elif an[0]==an[-1]:
        print(-1)
        break
    bn.append((bn[-1]*10)%K)
    n+=1
import sys

n = int(input())

seven = 7

if n < 7:
  print(-1)
  sys.exit()

for i in range(n):
  if seven % n == 0:
    print(i + 1)
    sys.exit()
  seven = seven * 10  + 7
print(-1)
n=int(input())

sm=0
work=7
for i in range(1,n):
    sm+=work
    if sm==n :
        print(i)
        break
    elif sm>n :
        sm-=n    
    work*=10
    work%=n

else : print(-1)
k=int(input())
c=0
x=0
for c in range(7):
  x=x+7*10**c
  if x%k==0:
    print(c+1)
    break
  if c==6:
    print(-1)
def main():

    k = input()
    K = int(k)
    if K % 2 == 0:
        print('-1')
    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()
n = int(input())
if n%2==0 or n%5==0:
    print(-1)

ans,c = 0,0

while 1:
    c+=1
    for i in range(10):
        if ((ans%10)+((n%10)*i)%10)%10==1:
            ans += n*i
            #print(ans,i)
            break
    ans = ans//10
    if ans==0:
        break
print(c)
K=int(input())
x=0
if K%2==0:
    print(-1)
    exit()
for i in range(K+1):
    x=(x*10+7)%K
    if x==0:
        print(i+1)
        break
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

K = int(input())
cnt = 0
now = 0
if K%2==0:
    print(-1)
    exit()
s = set([0])
for _ in range(10**6+5):
    now += pow(10, cnt, K)*7
    now %= K
    if now in s:
        print(cnt)
        break
    s.add(now)
    cnt += 1
else:
    print(-1)
K = int(input())

mod_ini = 7%K
mod = 0
cnt = 0

while True:
    if K%2 != 0:
        print(-1)
        break
    
    cnt += 1
    mod = (mod*10 + 7)%K
    #print(mod)
    
    if mod == 0:
        print(cnt)
        break
    elif mod == mod_ini and cnt != 1:
        print(-1)
        break
import sys
input = sys.stdin.readline
K = int(input())
flag = 0
seven = 0
if K % 2 != 0:
  for i in range(10000):
    seven = seven * 10 + 7
    if seven % K == 0:
      ans = i + 1
      flag = 1
      break
else:
  flag = 2
if flag == 2:
  print(-1)
elif flag == 0:
  print(K-1)
else:
  print(ans)
cnt = 1
mod = 7
k = int(input())

for i in range(k):
  if mod % k == 0:
    break
  cnt += 1
  mod = (mod * 10 * 7) % k

if mod % k == 0:
  print(cnt)
else:
  print(-1)
K = int(input().rstrip())
n = 1
if K%7==0:
    L = 9 * K / 7
else:
    L = 9 * K
R = 10 ** n
s = set()
while R!=1:
    R = (10 * R) % L
    n += 1
    if R in s:
        print(-1)
        break
    else:
        s.add(R)
else:
    print(n)
k = int(input())
if k % 2 == 0:
    print("-1")
    exit()
if k == 1 or k == 7:
    print("-1")
    exit()

seven_i = 7
for i in range(1,10**6):
    seven_i = seven_i*10+7
    seven_mod = seven_i % k

    if seven_mod == 0:
        print(i+1)
        exit()
    seven_i = seven_mod
print("-1")
k = int(input())
t = 7
t %= k

for i in range(1, k):
  if t == 0:
    print(i)
    exit()
  t = (t * 10 + 7) % k

print(-1)
def resolve():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        return
    for i in range(1, 10 ** 6):
        if (7 * pow(10, i, k)) % k == 7 % k:
            print(i)
            return
    print(-1)


if __name__ == '__main__':
    resolve()
K = int(input())
ans = 1
tmp = 7
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for i in range(1,K):
        tmp += (10 ** i) * 7
        ans += 1
        if tmp % K == 0:
            print(ans)
            break
        else:
            continue
K=int(input())
if K%2==0:
	print(-1)
else:
	seven=0
	m=0
	count=1
	for i in range(K+1):
		m=(m*10+7)%K
		if m==0:
			print(count)
			break
		count+=1
n=int(input())
if(n%2==0):
  print(-1)
elif(n==999983):
  print(999982)
elif(n==101):
  print(4)
n = int(input())

x = 7
ans = 1

for i in range(n+10):
  if x%n==0:
    break
  ans+=1
  x= x*10 + 7
  x=x%n
    
if ans < n:
  print(ans)
else:
  print(-1)
K=int(input())
count=0
n=7
if n%K==0:
    print('1')

while True:
    if K%2==0:
        print('-1')
        break
    count+=1
    n=7*10**count+n
    if n%K==0:
        print(count+1)
        break
K = input()
K = int(K)

def seven():
    seven_i = 0
    count = 0
    for i in range(K):
        seven_i += (10**i*7)
        seven_i %= K
        count += 1
        print(seven_i)
        if seven_i % K == 0:
            return count
    return -1

print(seven())
k=int(input())
flag=True
seq=7
"""
これは階乗を含むのでO(klogk)で重い
for i in range(1,k):
  if (7*(10**i-1)//9) % k==0:
    print(i)
    flag=False
    break
"""
for i in range(1,k):
  if seq%k==0:
    print(i)
    flag=False
    break
  seq=(seq*10+7)%k  # %k(modの考え方)がなければ10**6ではO(k)は重すぎた
  
if flag:
  print(-1)
import math
k = int(input())
sevens = []
for i in range(1, 6):
    sevens.append("7"*i)

sevens2 = [int(s) for s in sevens]
ans = []

for i in range(0, len(sevens)):
    if sevens2[i]%k == 0:
        ans.append(i+1)

if ans:
    print(min(ans))
elif k%2 == 0:
    print(-1)
elif k ==5:
    print(-1)
elif k ==9:
    print(-1)
else:
    print(k-1)
k=int(input())

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

if k%7==0:
  k//=7

o=0
m=1
if k==1:
  print(1)
  exit()

for i in range(1,k):
  m*=10
  o+=m%k
  o%=k
  if o==0:
    print(i)
    exit()
a=int(input())
b=0
if 7%a==0:b=b+1
if 77%a==0:b=b+1
if 777%a==0:b=b+1
if 7777%a==0:b=b+1
if 77777%a==0:b=b+1
if 777777%a==0:b=b+1
if 0==b: b=-1
print(b)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

INF = 10**9+7

if __name__ == "__main__":
    k = int(input())
    if k%2 == 0:
        print(-1)
        sys.exit()
    a = 7
    p = len(str(k)) + 1
    for i in range(p):
        if a%k == 0:
            print(i+1)
            sys.exit()
        a*=10
        a+=7
    print(k-1)
k = int(input())

x = "7"
n = 10
c = 1
if k >=7:
    while n>0:
        if int(x) % k == 0 : 
            break
        c+=1
        x += "7"
        n-=1
print(c)
#abc174_c

k=int(input())

# kの倍数が登場 -> 77...777%k==0となる最小の77の長さは？
if k%2==0:
    print(-1)
    exit()
if k==7:
    print(1)
    exit()

rem=7%k
for i in range(2,k+1):
    rem=(rem*10+7)%k
    if rem==0:
        print(i)
        exit()
print(-1)
K=int(input())
a=[0]*(K+1)
a[1]=7%K
for i in range(2,K+1):
  a[i]=(a[i-1]*10+7)%K
  if a[i]==0:
    print(i)
    exit()
print(-1)
k = int(input())
count = 0
temp = ''
remainder = 0
reminder_list = []

while True:
    count += 1
    temp += '7' # 7, 77, 777,,,
    reminder = int(temp) % k
    print(reminder)
    if reminder in reminder_list:
        count = -1
        break
    if reminder == 0:
        break
    else:
        temp = str(reminder % k)
    reminder_list.append(reminder)
print(count)