peterverebics/CodeNet_Python_118 huggingface dataset:
K = int(input())
seven = 7
count = 0

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

    if(count >= 1): 
        print(count + 1)
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')
import numpy as np
k = int(input())

Moji = ''
if k % 2 ==0:
  print(-1)
elif str(k)[0] == 5:
  print(-1)
elif k  < np.sqrt(7777777777):
  for i in range(10**6):
    Moji += '7'
    if int(Moji)%k == 0:
      print(i+1)
      break
      
else:
  print(k-1)
K=int(input())
n=1
an=7
for i in range(K+10):
    n+=1
    an=(10*an+7)%K
    if an==0:
        print(n)
        exit()
print(-1)
K = int(input())
if K%7 == 0:
  L = 9*K//7
else:
  L = 9*K

if L%2 == 0 or L%5 == 0:
  print(-1)
else:
  X = 10%L
  for i in range(K):
    X = X*10 % L
    if X == 1:
      print(i+2)
      break
import sys
input = sys.stdin.readline
 
def I(): return int(input())

def main():
    
    K = I()
    if K%2 == 0:
        print('-1')
        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())
a =7
for i in range(17000):
  if a%k ==0:
    print(i+1)
    break
  i +=1
  a = a + 7*10**(i)
else:
  print("-1")
K = input()
n = 7
for i in range(6):
    p = n % int(K) 
    if p == 0:
        break
    else:
        n = n * 10 + 7
if int(i) == 5:
    i = -1
else:
        i += 1
print(int(i))
def multiplier(i):
  cnt = 0
  number = 0
  while cnt <= i:
    number += 10 ** cnt
    cnt += 1
  return number

input_k = int(input())

count = 0
current_7 = 0

if input_k % 2 == 0:
  print("-1")
else:
  while True:


    current_7 = 7 * multiplier(count)
    
    
    if current_7 % input_k == 0:
      print(count-1)
      break
    else:
      count += 1
K = int(input())
x = 7
ans = 1
if x%K==0:
  print(ans)
visited = [0]*(K+1)
while x!=0:
  x %= K
  x = x*10+7
  x %= K
  if visited[x]:
    print(-1)
    exit()
  visited[x] = 1
  ans += 1
print(ans)
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(n)
            f = 1
            break
if f == 0:
    print(-1)
from collections import deque
import sys
input = sys.stdin.readline
import math

k = int(input())
n = 7
ans = -1

for i in range(10**4): #注意
  if n % k  == 0:
    ans = i+1
    break
  else:
    n =  n*10 + 7


def is_prime(z):
    if z == 1: return False

    for y in range(2, int(math.sqrt(z)) + 1):
        if z % y == 0:
            return False

    return True

if k%2==0:
  ans=-1
elif is_prime(k):
  ans = k-1
  

print(ans)
import sys
k = int(input())

a = [0]*k
a[0] = 7
cnt = 0

for i in range(1, k):
    a[i] = (10*a[i-1]+7) % k
     
if k % 2 == 0 or k % 3 == 0 or k % 5 == 0:
    print(-1)
    sys.exit()

for i in range(k):
    if a[i] == 0:
        print(i+1)
        break
k = int(input())
a = [None for i in range(10**7) ]

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

for i in range(1,k):
    if a[i] == 0:
        ans = i
        break

print(ans)
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(-1)
  sys.exit()
while True:
  if amari%K == 0:
    print(n)
    break
  amari = (amari*10 + 7)%K
  n += 1
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
else:
    print(-1)
#!/usr/local/bin/python3
# coding: utf-8
import numpy as np

kita = int(input())
seven = ""
i = 0
while True:
    i += 1

    if kita % 2 == 0:
        print(-1)
        break
    if kita % 2 == 0:
        print(-1)
        break

    seven += "7"
    if int(seven) > kita: 
        if int(seven) % kita == 0:
            print(i)
            break
K = int(input())
num = 0
if K%2 == 0:
    print(-1)
else:
    for i in range(1, 100000):
        num = num*10 + 7
        num %= K
        if num == 0:
            print(i)
            break
    else:
        print(-1)
N=int(input())
num = 7
plus = 70
i=1
a=[]
s = str(N)
array = list(map(int, s))
if(sum(array)%7!=0):
    N*=7
while num%N!=0:
    if num%N in a:
        i=-1
        break
    a.append(num%N)
    num+=plus
    plus*=10
    i+=1
print(i)
k = int(input())

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

a = 7
counter = 1

for i in range(k):
    r = a%k
    if(r == 0):
        print(counter)
        break
    else:
        counter += 1
        a = 10*r + 7%k
a=int(input())
b=-1
if 7%a==0:b=1
elif 77%a==0:b=2
elif 777%a==0:b=3
elif 7777%a==0:b=4
elif 77777%a==0:b=5
elif 777777%a==0:b=6
print(b)
import sys

input = sys.stdin.readline

k = int(input())
if k == 7:
    print(1)
elif k % 2 == 0 or k % 5 == 0: print(-1)
else:
    if k % 7 == 0: k = k // 7
    mod = 9*k
    i = 1;
    result = 10;
    while result != 1:
        result = (result * 10) % mod
        i += 1
    print(i)
k = int(input())
n = 0
frag = 0
sevens = ""

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

while frag==0:
    sevens = sevens + "7"
    n+=1
    if int(sevens)%k==0 or n>1000000:
        frag=1
print(n)
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)
    exit()
  start = (start * 10 + 7) % k
k = int(input())
cur = 0
flag = False
for i in range(1, k):
    cur *= 10
    cur += 7
    cur %= k
    if cur == 0:
        flag = True
        break
if flag:
    print(i)
else:
    print(-1)
k = int(input())

flag = False

resid  = 7
if k == 7:
    i = -1
    flag = True
else:
    for i in range(k):
        resid = (resid*10+7)%k
        if resid == 0:
            flag = True
            break

if flag:
    print(i+2)
else:
    print(-1)
K = int(input())
c = "-1"
for i in range(1,2000):
    if int("7"*i) % K == 0:
        c = i
        break
print(c)
n = int(input())
if n==0:
    print(0)
if n%2==0:
    print(-1)
elif n%5==0:
    print(-1)
else:
    k=7
    l=1
    while k!=0:
        l+=1
        k*=10
        k+=7
        k%=n
        #print(k)
    print(l)
def is_prime(a):
    if a == 1:
        return False
    i = 2
    while i * i <= a:
        if a % i == 0:
            return False
    return True

K = int(input())

if not is_prime(K) or K == 2:
    print(-1)

else:
    print(K - 1)
def solution(K: int) -> int:
    sevens: int = 0
    for i in range(1, K + 1):
        print(sevens)
        sevens = (sevens*10 + 7) % K
        if sevens == 0:
            return i
    return -1


K: int = int(input())

print(solution(K))
k = int(input())
a =7
for i in range(15000):
  if a%k ==0:
    print(i+1)
    break
  i +=1
  a = a + 7*10**(i)
else:
  print("-1")
K = int(input())

n = "7"*len(str(K))
for i in range(len(str(K)), len(str(K))*10000):
    print(i)
    if int(n) % K == 0:
        print(i)
        break
    n += "7"
else:
    print(-1)
import math
import sys
import copy
input = sys.stdin.readline
 
 
N=int(input())
 
if N==1 or N==7:
    print(1)
elif N%2==0:
    print(-1)

elif N==3:
    print(3)

elif N%5==0:
    print(-1)

elif N==11 or N==77:
    print(2)

elif N==777 or N==37 or N==111 or N==259:
    print(3)
    
elif N==101:
    print(4)

else:
    print(N-1)
    


#print(Wcount,Rcount)
k=int(input())
if k%2 == 0 or k%5 == 0:
  print(-1)
  exit()
s = ''
for i in range(10000):
  s += '7'
  if int(s) % k == 0:
    print(i+1)
    exit()
#nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
if k%7 == 0:
  k//=7
if is_prime(k):
  print(k-1)
  exit()
print(-1)
K = int(input())

now = 7

visited = [0]*(K+10)

flg = False

for i in range(1,9999):
    tmp = now%K
    visited[tmp] += 1
    now = now*10+7

    if tmp == 0:
        flg = True
        break
    if visited[tmp] > 1 :
        flg = False
        break
    
if flg:
    print(i)
else:
    print(-1)
k = int(input())
t = '7'
i = 0
if k % 2 == 0:
    print(-1)
elif (set(str(k))) == {'0', '1'} or k % 7 == 0:
    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())
 
i, a = 0, 0
l = []
for i in range(K-1):
  a = (10*a + 7) % K
  l.append(a)

j, ans = 0, -1
for j in range(K-1):
  if l[j] == 0:
    ans = j + 1
    break
    
print(ans)
K=input()
keta = len(K)
k=int(K)
if k%2==0:
  print(-1)
else:
  seven = "7"*keta
  s = int(seven)
  ans=keta-1
  for _ in range(2*k):
    ans+=1
    s = s%k
    if s==0:
      print(ans)
      break
    else:
      s = s*10+7
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    K = int(input())
    if K % 2 == 0:
        print(-1)
        return
    else:
        x = 7 % K
        for i in range(1, K+1):
            if x == 0:
                print(i)
                return
            x = (x*10+7) % K


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

n = 7
ans = 0
i = 1
if K%2==0:
    ans = -1
else:
    for i in range(K*2+10):
        if n%K==0:
            ans = i+1
            break
        n *= 10
        n += 7
        n %= K
print(ans)
from collections import defaultdict
import sys
mod = int(input())
d = defaultdict(int)
s = 7
c = 1
while(True):
    if s == 0:
        break
    if s in d:
        print(-1)
        sys.exit()
    d[s] = 1
    s = (s*10 + 7) % mod
    c += 1

print(c)
def main():
    K = int(input())

    if K % 2 == 0:
        return -1
    elif K % 5 == 0:
        return -1

    an_min = 7
    an_max = int("7" * K)

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

        an_min = an_min * 10 + 7

        if an_max % K == 0:
            return len(str(an_max))

        an_max = an_max // 10

if __name__ == "__main__":
    answer = main()
    print(answer)
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
else:
  t=7
  i=1
  for i in range(1,40000):
    if t%k==0:
      print(i)
      break
    else:
      t=t*10+7
      i=i+1
  else:
    print(k-1)
#C

K=int(input())
ans=-1
if K==1:
    ans=1
elif K==2 or K==5 or K==10:
    ans=-1
else:
    p=0
    for i in range(1,K):
        p = (p*10+7)%K 
        #print(i,p)
        if p==0:
            ans=i
            break

print(ans)
K = int(input())
if K%7 == 0:
  L = 9*K//7
else:
  L = 9*K

if K%2 == 0 or K%5 == 0:
  print(-1)
else:
  X = 10%L
  for i in range(K):
    X = X*10 % L
    if X == 1:
      print(i+2)
      break
k = int(input())
a = [None]*1000001
a[1]=7%k
n=0

for i in range(2,k+1):
    a[i]=(a[i-1]*10+7)%k
    if a[i]==0 and n==0:
        print("{}".format(i))
        n=1
if n==0:
    print("-1")
K = int(input())
if K % 7 == 0:
    L = 9 * K / 7
else:
    L = 9 * K
if K % 2 == 0 or K % 5 ==0:
    ans = -1
else:
    ans = 1
m = 10 % K
while(ans >= 0):
    if (m == 1):
        break
    m *= 10
    m %= L
    ans += 1
print(ans)
K = int(input())
if K % 2 == 0:
    print(-1)

cnt = 1
cur = 7
while True:
    if cur % K == 0:
        print(cnt)
        break
    a = K * cur
    b = str(a)
    b_set = set(b)
    if cnt > K:
        print('-1')
        break
    cur = (cur % K) * 10 + 7
    cnt += 1
n = 7
k = int(input())
amari = 7%k
for i in range(1, 10**6):
    amari += 7*pow(10, i, k)
    amari %= k
    if amari == 0:
        print(i+1)
        exit()
print(-1)
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    k = II()
    print(-1)

if __name__ == '__main__':
    main()
k = int(input())

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

for i in range(1, 11):
    if int('7'*i) % k == 0:
        print(i)
        break
else:
    print(k - 1)
K=int(input())
mod=K
n=7
if K%2==0:
  print(-1)
  exit()
for i in range(10**7):
  n=n*10%mod
  if n==7:
    print(i+1)
    exit()
#!/usr/bin/env python3
import time

k = int(input())
s = ''

rs = []

start = time.time()
cnt = 0 
while True:
    cnt += 1
    s += '7' 
    n = int(s)
    r = n%k 
    if r==0:
        print(cnt)
        exit()

    if r in rs: 
        print(-1)
        end = time.time()
        exit()

    rs.append(r)
    end = time.time()
    t = end-start 
    if t >= 1.98:
        print(k-1)
        exit()
import time
k = int(input())
kk = k
n = 7
c = 1
t1 = time.time() 
t2 = time.time()
while (t2-t1) <= 1.8:
  if k%7 == 0:
    s = str(k)
    if all(x=="7" for x in s):
      print(len(s))
      break
  k+=kk
  t2 = time.time()

if (t2-t1) > 1.8:
  print(-1)
K = int(input())
N = 0

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

print(-1)
import math
k = int(input())
count = 1
seven = 7
if k%2 == 0 or k%5 == 0:
    print(-1)
else:
    while True:
        if(seven%k==0):
            print(count)
            break
        else:
            seven += 7* (10**count)
            print (count)
            count+=1
k = int(input())


if k % 7 == 0:
    L = k/9
else:
    L = 9 * k


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

m = 1 % L

for i in range(k):
    m = (10 * m) % L
    if m == 1:
        print(i + 1)
        exit()
    elif i == k - 1:
        print(-1)
        exit()
K=int(input())
if K%2 == 0 or K%5 == 0:
  print(-1)
else:
  base = ''
  while(1):
    base += '7'
    if int(base)%K == 0:
      print(base)
      break
K = int(input())
S = "7"
# i = int(S) // K
a = 0
c = 0
if K % 2 == 0:
    print(-1)
    exit()
a = 7 % K
for i in range(K + 1):
    if a == 0:
        print(i + 1)
        break
    a = (a * 10 + 7) % K

        

# while int(S) % K != 0:
    # if K % 2 == 0:
    #     i = -1
    #     break
    # S += "7"
    # i += 1
# print(i)
K = int(input())
for i in range(1, K):
    if K % 2 == 0:
        print('-1')
        break
    elif int('7'*(i)) % K == 0:
        print(i)
        break
#  mod Nの取りうる値の上限はN-1なのでN-1回のループで解が出なければ-1でいい
#  modの値が同じになった場合ループになるためexitする

K = int(input())

mod = 7 % K

res = []

i = 1

while res.count(mod) == 0:
    if mod == 0:
        print(i)
        exit()

    res.append(mod)
    mod = (mod * 10 + 7) % K
    i += 1
from sys import stdin

def main():

    input = stdin.readline

    K = int(input())

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

    seven_len = 7

    ans = 0
    while seven_len != 0:
        seven_len = (seven_len * 10 + 7) % K
        ans += 1

    print(ans)


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

x = "7"
n = 10
c = 1
f = 1
if k >=7:
    while n>0:
        if int(x) % k == 0 : 
            f = 0
            break
        c+=1
        x += "7"
        n-=1
if f == 0: print(c)
else: print("-1")
k = int(input())
if k % 2 == 0:
    print(-1)
elif k ==7:
  	print(1)
else:
  amari = [7]
  tmp = 7
  for i in range(k):
      tmp = (tmp * 10) % k
      if tmp != 7:
          amari.append(tmp%k)
      else:
          break
  amari = amari * ((k//len(amari)) +1)

  ans = amari[0]
  for i in range(1, k+1):
      ans += amari[i]
      if ans % k == 0:
          print(i+1)
          break
  else:
    print(-1)
#!/usr/bin/env python3
import time

k = int(input())
s = ''

rs = []

start = time.time()
cnt = 0 
while True:
    cnt += 1
    s += '7' 
    n = int(s)
    r = n%k 
    if r==0:
        print(cnt)
        exit()

    if r in rs: 
        print(-1)
        end = time.time()
        exit()

    rs.append(r)
    end = time.time()
    t = end-start 
    if t >= 1.8:
        print(k-1)
        exit()
K = int(input())

ans = -1
num7 = 7;

for i in range(1000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = num7*10+7
        i+=1

print(ans)
k=int(input())
keta=str(k)
s=int("7"*len(keta))
a=-1
if k%2==0:
	print(a)
else:
	for x in range(len(keta),len(keta)+1000):
		print(s)
		if s%k==0:
			a=x
			break
		else:
			s=str(s)+"7"
			s=int(s)
	if a==-1:
		a=k-1
	print(a)
k = int(input())
if 7 % k == 0:
    print(1)
    exit()
memo = {}
mod = 1
cnt = 2
mm = 10 % k
m = 1
while True:
    m = (m * mm)%k 
    mod += m
    if mod % k == 0:
        print(cnt)
        break
    if mod in memo:
        print(-1)
        break
    memo[mod] = 0
    cnt += 1
k = int(input())
if k%2==0 or k%5==0:
    print(-1)
    exit()
    
def so(n):
  for i in range(2,n):
    if n%i==0:
      return False
  else:
    return True
    
t = 10**4
if k%7==0:
  k//= 7
l = len(str(k))
s = int(str(1)*l)
ind = l
while t!=0 :
    if s%k==0:
        print(ind)
        exit()
    else:
        s = s*10+1
        ind += 1
    t -=1
if so(k)==True:
  print(k-1)
  exit()
k=int(input())
c=0
x=7
s=-1
for c in range(k):
  if k==7:
      print(1)
      break
  x=x*10+7
  if x%k==0:
      s=c+1
      break
print(s)
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

k = list(map(int, input().split()))[0]

if (k % 7 == 0):
    l = 9*k/7
else:
    l = 9*k
dprint('k, l = ', k, l)

i = 1
n = 10
while(i < k):
    m = n % l
    if (m == 1): # (10^i mod L = 1)
        print(i)
        exit()
    dprint('i, n, m = ', i, n, m)

    i = i + 1
    n = m * 10
else:
    print(-1)
n =int(input())
if n%2==0:
    print(-1)
elif n==1:
    print(1)
else:
    ans =1
    start = 7
    while True:
        start = ((start%n*10%n)+7)%n
        #start = start%n
        #print(start)
        if start ==0:
            ans+=1
            print(ans)
            break
        ans+=1
K = int(input())

mod = 7
for i in range(1, K):
    if mod%K==0:
        print(i)
        exit()
    mod = (mod*10+7) % K
    i += 1
k = int(input())
n = '7'
cnt = 1
if k % 2 == 0:
    print(-1)
else:
    while True:
        num = int(n)
        if num%k == 0:
            print(cnt)
            break
        elif cnt == 1000:
            print(k-1)
            break
        else:
            cnt += 1
            n += '7'
K = int(input())

keta = 1 # 数列の桁数
seven = 7 # 数列の項
ans = -1 # 答え

if K % 2 == 0:
    print(ans)

else:
    while True:
        if K <= seven:
            if seven % K == 0:
                ans = keta
                break
        
        seven += 7 * (10 ** keta)
        keta += 1

print(ans)
k=int(input())
a=7%k
sm=7
for i in range(k):
  if sm%k==0:
    print(i+1)
    break
  a=(10*a)%k
  sm+=a
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -2
else:
  while x%k != 0:
    x *= 10
    x+=7
    if x%k != 0:
      ans +=1

ans +=1
print(ans)
k = int(input())
sev = []
c = 0
if k == 1:
    print(-1)
elif k == 2:
    print(-1)
elif k % 5 == 0:
    print(-1)
elif k % 2 == 0:
    print(-1)
else:
    while 1:
        sev.append('7')
        sevens = int(''.join(sev))
        rem = sevens % k
        if rem == 0:
                res = c + 1
                print(res)
                break
        c += 1
import sys
k = int(input())
n = 0
frag = 0
sevens = ""

while frag==0:
    sevens = sevens + "7"
    n+=1
    if int(sevens)%k==0:
        frag=1
    elif n>10000:
        print("-1")
        exit()
print(n)
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+100):
        if a%k == 0:
            print(i+1)
            sys.exit()
        a*=10
        a+=7
    print(k-1)
K = int(input())

seven = "7"
flag = 1

if K%2==0:
	print(-1)
	
else:
	for i in range(1,10000):
		if int(seven*i) % K == 0:
			print(i)
			flag=0
			break
	
	if flag:
		print(-1)
K=input()
keta = len(K)
k=int(K)
if k%2==0:
  print(-1)
else:
  seven = "7"*keta
  s = int(seven)
  ans=keta-1
  for _ in range(k):
    ans+=1
    s = s%k
    if s==0:
      print(ans)
      break
    else:
      s = s*10+7
k, R = int(input()), 1
for i in range(1, k+10):
    if R % k == 0:
        print(i)
    R = R * 10 + 7
k = int(input())
if k % 2 == 0:
    print(-1)
 
amari = [7]
tmp = 7
for i in range(k+1):
    tmp = (tmp * 10) % k
    if tmp != 7:
        amari.append(tmp%k)
    else:
        break
amari = amari * ((k//len(amari)) +1)
 
ans = amari[0]
for i in range(1, k+1):
    ans += amari[i]
    if ans % k == 0:
        print(i+1)
        break
else:
  print(-1)
import sys
K=int(input())
rest = 7 % K
if rest == 0:
  print(1)
  sys.exit()
for i in range(2,K): 
  rest = (rest*10+7) % K
  if rest == 0:
    print(i)
    sys.exit()
else:
  print(-1)
import sys
K=int(input())
if K%2==0 or K%5==0:
    print('-1')
    sys.exit()
i=1
K=9*K
ans=10-K

while(1):
    i+=1
    ans=ans*10%K
    if 7*(ans-1)%K==0:
        print(i)
        sys.exit()
K = int(input())
cnt=0
divK = 7
if K %2 ==0:
	print(-1)
	exit()
while True:
	if divK== 0:
		print(cnt+1)
		break
	divK = (divK*10+7)%K
	cnt +=1
def main():
    K = int(input())

    tmp1 = 7 % K
    tmp2 = tmp1

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

    print(-1)


if __name__ == "__main__":
    main()
k = int(input())
mod = 7 % k
ans = 1
for i in range(10**6):
    if k % 2 == 0:
        ans = -1
        break
    if mod == 0:
        break
    mod = (mod*10+7)%k
    ans += 1
print(ans)
k = int(input())

ans = []
memo = 7 % k
if(7 % k == 0):
    ans.append(0)
for i in range(k):
    memo = (10*memo + 7) % k
    if memo % k == 0:
        ans.append(i)
print(-1 if not len(ans) else ans[0] + 2)
s=0
l=[]
k=int(input())
if k%2==0:
  print(-1)
else:
  while(1):
    s=s*10+7
    l.append(s)
    if s%k==0:
      print(l.index(s))
      break
k = int(input())

count = 0
ans = 1

while True:
  num = int("7" + "7" * count)
  if ans > 6:
    print(-1)
    break
  if num % k == 0:
    print(ans)
    break
  count += 1
  ans += 1
K = int(input())

if 7%K==0:
  print("1")
  exit(0)
if 77%K==0:
  print("2")
  exit(0)
if 777%K==0:
  print("3")
  exit(0)
if 7777%K==0:
  print("4")
  exit(0)
if 77777%K==0:
  print("5")
  exit(0)
if 777777%K==0:
  print("6")
  exit(0)
if 7777777%K==0:
  print("7")
  exit(0)
  
print("-1")
num=int(input())
a=7
flag=0
for i in range(num):
    a=(a*10+7)
    if a%num==0:
        print(i)
        flag=1
        break
    
if flag==0:
    print("-1")
K=int(input())
for i in range(1,100000):
    if list(set(str(K*i)))==["7"]:
        print(len(str(K*i)))
        break
    elif i==9999:
        print("-1")
K = int(input())
list = [7,77,777,7777,77777,777777]
for i in range(7):
    if i == 6:
        print(-1)
    elif list[i] % K == 0:
        print(i+1)
        break
k=int(input())
x=7%k
l=[]
for i in range(1,k+1):
  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())

n = 7
i = 1

while i <= K:
    if n%K == 0:
        ans = i
        break
    n = n*10 + 7
    i += 1
    
else:
    print(-1)
import math

def main():

    k = int(input())
    if k % 2 == 0:
        print('-1')
    else:
        for i in range(1, int(math.sqrt(k))):
            target = int('1' * i) * 7
            if target % k == 0:
                print(i)
                break
        else:
            print(k - 1)


if __name__ == '__main__':
    main()
k=int(input())
a=[str(7)*x for x in range(1,100)]
b = [int(i) for i in a]
r=[]
for x in b:
    if x%k==0:
        r.append(len(str(x)))
    else:
        r.append(-1)
print(r[0])
k = int(input())
if k==7:
  print(1)
elif k%2==0:
  print(-1)
else:
  cnt = 1
  pre = 7
  while(True):
    surp = (pre*10+7)%k
    cnt += 1
    if surp==0:
      break
    pre = surp
  print(cnt)
def main():
    k = int(input())
    num = 1
    n = 7

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

if __name__ == '__main__':
    main()