peterverebics/CodeNet_Python_118 huggingface dataset:
K=int(input())
temp=0
for i in range(1,10**6+1):
  t="7"*K
  r=int(t)%K
  if(r%K==0):
    print(i)
    temp=1
    break
if(temp==0):
  print(-1)
k = int(input())

def k_multipul_at(k: int) -> int:
  r = 7 % k
  cache = [r, 0]
  i = 1
  while r not in cache:
    r = (r * (10 % k) + 7 % k) % k
    cache.append(r)
    i += 1
  return -1 if r else i

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

num = 7
for i in range(1, k):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7
N = int(input())

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

n7 = 0
 
for i in range(6):
  n7 += 7*(10**(i))
  if n7 % N == 0:
    print(i+1)
    exit()

print(-1)
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)/k
  if a == 0:
    print(i+1)
    quit()
print(-1)
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())

seven=0
m=1
while m!=0:
	seven=seven*10+7
	m=seven % K

print(seven)
import sys

n=int(input())

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

Ai=[7%n]
for i in range(1,n+1):
    res=(Ai[i-1]*10 + 7)%n
    if res ==0:
        print(i+1)
        sys.exit()
    Ai.append(res)
print(-1)
k = int(input())
n = '7'
cnt = 1
if k % 2 == 0:
    print(-1)
else:
    while cnt <= 50:
        num = int(n)
        if num%k == 0:
            break
        elif cnt == 50:
            print(k-1)
            break
        else:
            print(num%k)
            cnt += 1
            n += '7'
K = int(input())
nana=7
kou=1
if K % 2 == 0:
    print(-1)
else:
    for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
    print(kou)
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)
else:
    print(k-1)
import numpy as np
k = int(input())

if k % 2 ==0:
  print(-1)
elif str(k)[0] == 5:
  print(-1)
elif k  == 101:
  print(4)
else:
  print(k-1)
n=int(input())
x=7
s=1
while s<n:
    if x%n==0:
        break
    else:
        x=int(str(x)+"7")
        s+=1
print(s)
K = int(input())
N = 10
a = 0
l = 9*K
for i in range(1,10**6):
  N = (10*N)%l
  if (N*7-7)%l==0:
    print(i+1)
    a +=1
    break
if(a == 0):
  print(-1)
K = int(input())  # ぜんぜんちがう
ans = -1
 
def moduloseven(K):
	for i in range(1000):
		sev = int(str(7)*(i+1))
		if sev % K == 0:
			ans = i+1
			break
		else:
			ans = K-1
	return(ans)
 
if K % 2 != 0:
	if K % 5 != 0:
		ans = moduloseven(K)
print(ans)
K=int(input())
sevens=7
count=1

if K%2==0:
  print(-1)
else:
  while True:
    if sevens%K==0:
      print(count)
      break
    else:
      sevens+=7*(10**count)
      
      if sevens>10**6:
        print(-1)
        break
        
      count+=1
k = int(input())

sevens = [0] * k

sevens[0] = 7 % k

if k == 7:
    print(1)
else:
    for i in range(1, k):
        new = (sevens[i - 1] * 10 + 7) % k
        sevens[i] = new

        if new == 0:
            print(i + 1)
            break
    else:
        print(-1)
K = int(input())

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

k = 7
cnt = 1
for i in range(10 ** 7):
  if k % K == 0:
    break
  k = (k * 10 + 7) % K
  cnt += 1
else:
  print(-1)

print(cnt)
def main():
    import sys
    import time
    start=time.time()
    K=int(sys.stdin.readline())
    s=''
    while True:
        s+='7'
        if int(s)%K==0:
            print(len(s))
            break
    
        if time.time()-start>=1.8:
            print(-1)
            break

main()
def main():

    k = int(input())
    a = [0] * (10 ** 6 + 1)
    a[0] = 7 % k
    for i in range(1, k + 1):
        a[i] = (a[i - 1] * 10 + 7) % k
        if a[i] == 0:
            print(i + 1)
            exit()
    print(-1)

if __name__ == '__main__':
    main()
n = int(input())
x, found = 0, False
for i in range(1, n):
  x = ((10 * x) + 7)%n
  if x == 0:
    print(i)
    found = True
    break

if not found:
  print(-1)
K = int(input())

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

X = 7
count = 1

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

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

if K == 7:
    print(1)
elif K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    count = 1
    num = 7
    while True:
        num = (num * 10 + 7) % K
        count += 1
        if num == 0:
            print(count)
            break
K = int(input())

count = 0
num = 7
if K % 2 == 0:
    print(-1)
else:
    while True:
        if num % K == 0:
            count += 1
            break
        else:
            count += 1
            num = int(str(num) + "7")
print(count)
import sys
input = sys.stdin.readline
 
def I(): return int(input())

def main():
    
    K = I()
    if K%2 == 0:
        print('-1')
        sys.exit()
    
    ans = 1
    n = 7
    for i in range(K):
        
        if n%K ==0:
            print(ans)
            break
        
        n = (10*n + 7)%K  
        ans += 1

main()
K = int(input())

if K%2 == 0 or K%5==0:
    print(-1)
else:
    x = -1
    for i in range(1,K):
        a = (10**i -1)*7
        b = 9*K
        if a%b == 0:
            x = i
            break

    print(x)
k = int(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
K = int(input())
n = 7
base_m = 7 % K
count = 1

def next_line(n):
    return n * 10 + 7

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

else:
    while(True):
        n = next_line(n)
        m = n % K
        count += 1

        if m == 0:
            print(count)
            break
        
        elif m == base_m:
            print(-1)
            break
K = int(input())
A = 7 % K 

for i in range(1, K + 1):
    if A % K == 0:
        print(i)
        break
    A = (10 * A + 7) % K
k=int(input())
x=7
if k%2==0:
  print(-1)
elif k==7:
    print(1)
else:
    for i in range(k):
        x=x+7*10**(i+1)
        if x%k==0:
            print(i+2)
            quit()
import math
import time

K = int(input())
start_time = time.time()
seven_number = 0
while True:
    elapsed_time = time.time() - start_time
    seven_number = seven_number*10+7
    target_number = math.gcd(K,seven_number)
    if elapsed_time > 0.1:
        print("-1")
        break
    elif target_number == 1:
        continue
    else:
        print(len(str(seven_number)))
        break
k = int(input())


i = 0;
mod = 0;
while True:
    mod = (mod*10 + 7) % k;
    print(mod)
    if mod == 0:
        break;
    i += 1;
    if i == k:
        i = -2
        break;

print(i+1)
import math

K = int(input())
sevn = 7
while True:
    if K < 7:
        print(-1)
        break
    f, i = math.modf(sevn / K)

    if f == 0.0:
        print(len(str(sevn)))
        break
    sevn = str(sevn) + '7'
    sevn = int(sevn)
    print(sevn)
K = int(input())
 
if K % 2 == 0:
  print(-1)  

else:
  i = 0
  tmp_n = 0
  while i >= 0:
    tmp_n = tmp_n + 10**i * 7
 
    # print('tmp_n: ', tmp_n)
    if tmp_n != 0 and tmp_n % K == 0:
      break
    i += 1
    
  print(i)
K=int(input())
if K%2==0 or K%5==0:
	print("-1")
	exit()
for n in range(1,10**4+1):
	if (7*(10**n-1)//9)%K==0:
		print(n)
		exit()
else:
	print(K-1)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
K = int(input())
res = 0

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

surplus = 1
while True:
    res += 1
    surplus = (10 * surplus) % (9*K)
    if surplus == 1:
        break

print(res)
import math

k=int(input())

if k%7==0:
  k=int(k/7)

if k%2==0 or k%5==0:
  print(-1)
else:
  count=0
  for i in range(1,k):
    if math.gcd(i,k)==1:
      count+=1
  
  num=1
  for i in range(2,count):
    num+=(10**i)%k
    num=num%k
    if num==0:
      print(i)
      break
K = int(input())
X = 1
temp = 7
ans = 1

if K == 7:
  print(ans)
  exit()

for i in range(10**6+1):
  X = X * 10 % K
  temp += X * 7
  temp %= K
  ans += 1
  if temp == 0:
    print(ans)
    break
  if i == 10**6:
    print(-1)
ip = int(input())

ans = 7

for i in range(1,8):
    if int(ans) % ip == 0:
        print(i)
        break
    elif i == 8:
        print(int(ans)-1)
    else:
        ans = int(ans) * 10 + 7
        i += 1
K = int(input())
if K%2 == 0 or K%5 == 0:
  print(-1)
else:
  if K%7 == 0:
    L = K//7
  else:
    L = 9*K
  c = 1
  for i in range(10**7):
    c = (10*c)%L
    if c%L == 1:
      print(i+1)
      break
def resolve():
    '''
    code here
    '''
    K = int(input())

    is_not_found = True
    memo = [0 for _ in range(K)]

    i=7%K
    memo[i] += 1
    res = 1
    while is_not_found and memo[i] == 1:
        i = (i * 10 + 7) % K
        memo[i] += 1
        res += 1
        if i == 0:
            is_not_found = False

    print(res) if is_not_found == False else print(-1)


if __name__ == "__main__":
    resolve()
n = int(input())
if n % 2 == 0:
  print(-1)
else:
  a = 7
  for i in range(1000000):
    if a % n == 0:
      print(i+1)
      break
    a = (a%n) * 10 + 7
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)

cnt = 1
cur = 7
while True:
    if cur % K == 0:
        print(cnt)
        break
    if cnt > K:
        print('-1')
        break
    cur = (cur * 10 + 7) % K
    cnt += 1
K = int(input())

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

num = 7
for i in range(K):
  if num % K == 0:
    print(i)
    exit()
  else:
    num = num*10 + 7

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

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

a = 0
if K < 900000:
  for i in range(K):
    a = 7 * 10**(i) + a
    if a % K == 0:
      print(i)
      break
elif K >= 900000:
  print(999982)
K = int(input())
if K%2==0:
    print("-1")
else:
    ans = 0
    temp = 0
    check = 0
    for i in range(K):
        ans += 1
        temp *= 10
        temp += 7
        temp %= K
        
        if temp==0:
            check+=1
        
        if check==1:
            break
    print(ans)
k = int(input())
x = 7
ans = 1
for i in range(k):
    if x == 0:
        print(ans)
        exit()
    ans += 1
    x = (x * 10 + 7) % k

print(-1)
def main():
  s = input()
  k = int(s)
  if k % 2 == 0:
    print("-1")
    exit(0)
  kurai = 1
  count = 1
  sevens = 0
  while True:
    sevens = sevens + 7 * kurai
    if sevens % k == 0:
      print(str(count))
      break
    else:
      count+=1
      kurai = kurai * 10
    print(str(count))

if __name__ == "__main__":
  main()
K = int(input())

tmpNum = 7
count = 1
keisuu = 10

tmp = tmpNum%K
aa = tmp
while tmp !=0 and count<K:
    aa = (aa*10)%K
    tmp = (tmp+aa)%K
    count+=1

if count==K:
    count=-1

print(count)
k = int(input())
x = 7%k
s = []

while s.count(x) == 0:
  s.append(x)
  if x == 0:
    print(len(s))
    break
  x = (10*x + 7)%k

  
if s.count(x) != 0:
  print(-1)
k = int(input())
flag = [0 for _ in range(k)]
val = 7
cnt = 1
while cnt != 1000000:
  cnt += 1
  val = ((10 * val) % k + 7) % k
  if val == 0:
    break

if cnt == 1000000:
  print(-1)
else:
  print(cnt)
A = int(input())

if A>777777:
  print(-1)
elif A<7:
  print(-1)
elif A<=7 and 7%A==0:
  print(1)
elif A<=77 and 77%A==0:
  print(2)
elif A<=777 and 777%A==0:
  print(3)
elif A<=7777 and 7777%A==0:
  print(4)
elif A<=77777 and 77777%A==0:
  print(5)
elif A<=777777 and 777777%A==0:
  print(6)
def a(n):
  if(n==1):
    print(-1)
    return 0
  for p in range(2, n):
      if n % p == 0:
          print(-1)
          return 0
  if(n==2 or n==5):
    print(-1)
    return 0
  if(n==7):
    print(1)
    return 0
  cnt=1
  t="1"
  while(1):
    t=t+"1"
    cnt=cnt+1
    if(int(t) % n ==0):
      print(cnt)
      break
    

n = int(input())
a(n)
K = int(input())

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

if(i == 999999):
    print('-1')
else:
    print(i+1)
K=int(input())
if(K==7):
    print("1")
elif(K==1):
    print("1")
import sys
K = int(input())

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

print(-1)
k = int(input())
b = 0
if k % 2 == 0:
    print("-1")
else:
    a = ""
    b = 0
    while True:
        a = a+"7"
        b += 1
        a_int = int(a)
        if a_int % k == 0:
            break
        else:
            pass
print(b)
def main(K):
    if K % 2 == 0:
        print(-1)
        return

    num = 7

    while True:
        if num % K == 0:
            print(len(str(num)))
            return

        num = int(str(num) + "777")

    print(-1)


# [N, D] = map(int, input().split())
# lines = []
# for i in range(N):
#     lines.append(list(map(int, input().split())))
K = int(input())
main(K)
#!/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()
else:
    s = "7"
    rk = 7
    for i in range(1, 10 ** 6 + 1):
        rk1 = ((10 % k) * rk + 7 % k) % k
        if rk1 == 0:
            print(i + 1)
            exit()
        rk = rk1
x=int(input())

def mult(x):
    t=str(7)*(length(x))
    if length(x)<=len(t) and x <= int(t):
        print(t)
    else:
        t=str(7)*(length(x)+1)
        print(t)

def length(x):
    if x==0:
        return 0
    if x<0:
        return length(x*(-1))
    elif x < 10:
        return 1
    else:
        return 1+(length(x // 10))

mult(x)
import sys
K = int(input())
l_begin = 7
count = 1
for i in range(100):
    if l_begin % K == 0:
        print(count)
        sys.exit()
    l_begin = 10 * l_begin + 7
    count += 1
    if K > 10000 and K <= 1000000 and K % 7 != 0 :
        print(K-1)
        sys.exit()

print(-1)
K=int(input())
a=[0]*1000001
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())

def k_multipul_at(k: int) -> int:
  r = 7 % k
  cache = [r]
  i = 1
  while r not in cache and r:
    r = r * (10 % k) + 7 % k
    cache.append(r)
    i += 1
  return -1 if r else i

print(k_multipul_at(k))
k = int(input())
count=1
x=7
#for i in range(1,10):
    #print(x)
while True:
    x+=7*(10**count)
    if k%2==0:
        break
    
    if x>k and x%k==0:
        print(count+1)
        break
    count+=1
if count==1:
    print(-1)
n = int(input())
if n%2==0:
    print(-1)
elif n%5==0:
    print(-1)
else:
    k=7
    while k%n!=0:
        k*=10
        k+=7
        if k%n==0:
            print(len(str(k)))
            break
K = int(input())
x = [7, 77, 777, 7777, 77777, 777777]
Count = 0
flag="FALSE"
for i in x:
    Count = Count + 1
    if (i % K)==0:
        flag="TRUE"
        break

if flag=="FALSE":
    Count = -1
if K>=777777:
    Count = K - 1
print(Count)
k = int(input())
if k%2==0 or k%5==0:
    print('-1') 
else:
    a = 0
    for i in range(99983):
        a = (a*10+7) % k
        if a == 0:
            print(i+1)
    else:
        print(-1)
N = int(input())
 
if N % 2 == 0:
  print(-1)
  exit()
 
n7 = 0
 
for i in range(7):
  n7 += 7*(10**(i))
  if n7 % N == 0:
    print(i+1)
    exit()
 
print(-1)
from sys import stdin
K = int(stdin.readline().rstrip())
def main(K):
  a=0
  for i in range(1,K):
    a = ((10%K) * a + 7)%K
    if a == 0:
      return i
  return -1
print(main(K))
K = int(input())
r = 1
for i in range(1,K+1):
    r += pow(10,i,K)
    #print(r)
    r %= K
    if r == 0:
        print(i+1)
        break
else:
    print(-1)
K=int(input())
mod=9*K
n=1
if K%2==0:
  print(-1)
  exit()
for i in range(1,K+1):
  n=n*10%mod
  if n==1:
    print(i)
    exit()
k = input()
k = int(k)
if 1 <= k and k <= 1000000:
    for i in range(1, 8):
        n = "7"*i
        n = int(n)
        if n%k == 0:
            print(n)
        else:
            print(-1)
import sys
x = int(input())
if x%2 == 0:
    print(-1)
    sys.exit()
y = 7
i = 1
while y%x != 0:
    if i == 10000:
        print(-1)
        sys.exit
    i = i + 1
    y = y*10 + 7
print(i)
K = int(input())

t = 7
for i in range(K):
  print(t)
  if t % K == 0:
      break
  t = (t * 10 + 7) % K
else:
  print(-1)
k_len = input()
k = int(k_len)
number = len(k_len)
Seq = 7

while True:

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

    elif Seq % k == 0:
        print(number)
        break
    else:
        Seq = Seq + 7 * (10 ** number)
        number += 1
        print(Seq)
N=int(input())
num = 7
plus = 70
i=1
a=[]

while num%N!=0:
    b=num//N
    print(b*N,num%N)
    if num%N in a:
        i=-1
        break
    a.append(num%N)
    num+=plus
    plus*=10
    i+=1
    if i>N:
        i=-1
        break
print(i)
def main(k):
    size, res = 1, 7 % k
    while res and size <= k:
        res = (res * 10 + 7) % k
        size += 1
    return -1 if size > 1_000_000 else size


if __name__ == '__main__':
    k = int(input())
    print(main(k))
K = int(input())
 
i = 0
t = 7
 

while True:
  if K % t == 0: 
    print(i)
    break
  elif t > 10**6:
    print(-1)
    break
 
  i += 1  
  t += 7 * 10**i
k = int(input())
k *= 7
l = k % 10
if l == 1:
    m = 7
elif l == 3:
    m = 9
elif l == 7:
    m = 1
elif l == 9:
    m = 3
else:
    m = -1
if m == -1:
    print(-1)
else:
    x = k
    for i in range(10 ** 10):
        s = str(x)
        if len(s) == s.count("7"):
            print(len(s))
            break
        else:
            x = k * m
            m += 10
K = int(input())

res = -1
count = 1
sum = 7
prev = []
r = sum % K
while(r not in prev):
    prev.append(r)
    sum = sum * 10 + 7
    r = sum % K
    if(r == 0):
        res = count+1
        break
    count += 1

print(res)
K = int(input())
ans = 0
if K == 7:
    print(1)
    exit()
for i in range(10**6):
    ans += pow(10,i,K)
    if ans % K == 0:
        print(i+1)
        exit()
print(-1)
K = int(input())

N = 0

for i in range(K):
    N += N*10+7
    if N%K ==0:
        print(i)
        break
else:
    print(-1)
K=int(input())
base=7
for i in range(1,K):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K
print(-1)
s = int(input())
su = 0
sum = []
for i in range(0,s):
    su=su*10+7
    if su not in sum:
        sum.append(su)
for i in range(len(sum)):
    if sum[i]%s==0:
        print(sum[i])
        exit()
for i in sum:
    if i%s !=0:
        continue
print(-1)
import math
import time

K = int(input())
start_time = time.time()
seven_number = 0
while True:
    elapsed_time = time.time() - start_time
    seven_number = seven_number*10+7
    target_number = math.gcd(K,seven_number)
    if elapsed_time > 1:
        print("-1")
        break
    elif target_number == 1:
        continue
    else:
        print(len(str(seven_number)))
        break
K = input()
N = 10 **10
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')
import sys
k=int(input())
l=[]
x=7%k
if x == 0:
  print(1)
sys.exit()
for i in range(2,k+1):
  x=7%k
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)
K = int(input())
"""
i = 1

while True:
    seven = int('7' * i)
    if seven % K == 0:
        print(i)
        exit()
    
    if i > 10**6:
        print(-1)
        exit()

    i += 1
    """

cnt = 0
for i in range(1, 10**6+1):
    cnt += K
    
    if set(str(cnt)) == {'7'}:
        print(len(str(cnt)))
        exit()

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

max_num = 10 ** 20

i = 1
s = 0
while s < max_num:
  s = (7 * (10**i) - 7) // 9
  if s % K == 0:
    print(i)
    exit()
  i += 1
print('-1')
K = int(input())

a = [0]*K
a[0] = 7%K
ans = -1
for i in range(K-1):
    if(a[i]==0):
        ans = i+1
        break
    a[i+1] = (10*a[i]+7)%K
print(ans)
x= int(input())
if x%2!=0 or x%5!=0 :
    print(-1)
i=1
while True:
  if (10**i -1)%(9*x) ==0:
    break
  else:
    i+=1
print(i)
K = int(input())
if (K % 5 == 0) | (K % 2 == 0):
    print(-1)

elif K == 7:
    print(1)

else:
    if (K % 7) == 0:
        K //= 7

    T, R, md, Ans = (1, 1, 0, -1)

    for i in range(1, K + 1):
        md = 10 % K
        R = (R * md) % K
        T = (T + R) % K

        if T == 0:
            Ans = i + 1
            break

    print(Ans)
def main():
    K = int(input())
    if K % 2 == 0 or K % 5 == 0:
        print(-1)
        return
    cnt = 1
    tmp = 7
    while tmp != 0:
        tmp = tmp * 10 + 7
        tmp %= K
        cnt += 1

    print(cnt)

main()
K = input()
N = 10 **10
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')
K = int(input())
if (K % 5 == 0) | (K % 2 == 0):
    print(-1)
elif K == 7:
    print(1)

else:
    Ans = -1
    a = 7 % K

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

        if a == 0:
            Ans = i + 1
            break

    print(Ans)
def main():
    k = int(input())
    counter = len(str(k * 7))

    while True:
        if k % 2 == 0:
            print(-1)
            return 
        counter += 1
        temp7 = ''.join((["7"] * counter))
        if int(temp7) % k == 0:
            print(len(temp7))
            return 

if __name__ == "__main__":
    main()
import math
import sys

K = int(input())

if K%2 == 0 or K%5 == 0:
  print(-1)
  sys.exit()
n = round(math.log10(K)+1)
amari = int(7*(10**n - 1)/9 % K)
if amari == 0:
  print(n)
  sys.exit()
while True:
  if amari%K == 0:
    print(n)
    break
  amari = (amari*10 + 7)%K
  n += 1
k=int(input())
i=1
se=7
for _ in range(k):
    se=se*10+7
    i+=1
    if se%k==0:
        print(i)
        exit()
    se %= k
print('-1')
k = int(input())
x = 7 % k
cnt = 0
for i in range(2 * 10 ** 6):
    if x == 0:
        break
    x = (x * 10 + 7) % k
    cnt += 1
print(cnt + 1)
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 (41,271,41*271):
    print(7)
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()
if K ==7:
    print(1)
else:
    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())

p = []
x = 0
a = 0
while True:
    if K%2 == 0:
        a = -1
        break
    a += 1
    x = x + (10**a)*7
    p.append(x)
    if x%K == 0:
        break
print(a)
n=int(input())
a=[7]
for i in range(40000):
  a.append(a[-1]*10+7)
if n%2==0 or n%5==0:
  print(-1)
else:
  flg=0
  for i in a:
    if i%n==0:
      print(len(str(i)))
      flg=1
      break
  if flg==0:
    print(n-1)
K = int(input())
n = 7
a = 1
if K ==1:
  print(1)
elif K%2 == 0:
  print(-1)
elif K%5 == 0:
  print(-1)
else:
  while n % K != 0:
    n = 10*n + 7
    a = a + 1
    if n % K == 0:
      print(a)
      break
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())

if 7 % k == 0:
    print(1)

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



ans = 0
prev = 7
for i in range(1000000):
    prev = prev * 10 + 7
    if prev % k == 0:
        print(i+2)
        ans = 1
        break

if ans == 0:
    print(-1)
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations,permutations
from copy import deepcopy
import sys
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    K = int(input())
    sevens = 7 
    for i in range(1, K):
        if sevens%K==0:
            print(len(str(sevens)))
            quit()
        sevens = sevens*10+7
    print(-1)