peterverebics/CodeNet_Python_118 huggingface dataset:
K = int(input())
S = "7"
# i = int(S) // K
a = 0
c = 1
if K % 2 == 0:
    print(-1)
    exit()
a = 7 % K
for i in range(K):
    if a == 0:
        break
    a = (a * 10 + 7) % K
    c += 1

print(c)

        

# while int(S) % K != 0:
    # if K % 2 == 0:
    #     i = -1
    #     break
    # S += "7"
    # i += 1
# print(i)
import math
K = int(input())

S = [int('7' * i) for i in range(1, 8)]
start = math.floor(math.log(K, 10))
count = [a for a in S[start:] if a % K == 0]
if len(count) == 0:
    print(-1)
else:
    print(len(str(count[0])))
K = int(input())
l = [0 for i in range(K)]
r = 0
for i in range(K):
    if i == 0:
        if 7%K == 0:
            print(1)
            break
        else:
            r = 7%K
            l[r] = 1
    else:
        r = (10*r+7)%K
        if r == 0:
            print(i+1)
            break
        elif l[r] != 0:
            print(-1)
            break
k = int(input())
if k % 2 == 0:
  print(-1)
elif k < 7:
  print(-1)
else:
  a = 0
  count = 1
  num = "7"
  while a == 0:
    if int(num) % k == 0:
      print(count)
      a += 1
    else:
      num += "7"
      count += 1
K = int(input())
num = K +1
i = 1
while i <= K:
  num = (10**i-1)*7//9
  if num % K == 0:
    break
  i += 1
if i > K :
  print(-1)
else:
  print(num)
# C - Repsept
def main():
    k = input()

    if int(k) % 2 == 0:
        print(-1)
    else:
        for i in range(len(k), int(int(k)**0.5)):
            li7 = '7'*i
            if int(li7) % int(k) == 0:
                print(i)
                exit()
        else:
            print(int(k)-1)


if __name__ ==  "__main__":
    main()
import sys
input = sys.stdin.readline
K = int(input())
i = 0
n = 0
  
while n <= 10**7:
  n += 7 * (10**i)
  i += 1
  if n % K == 0:
    print(i)
    break
  elif K % 2 == 0:
    print("-1")
    break
  elif K == 999983:
    print("999982")
    break
  else:
    pass
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 7
for i in range(10**6):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7
n = int(input().rstrip())

def calc(target):
    result = 0
    count = 0
    if target % 2 == 0:
        return -1
        
    for i in range(n):
        result = (result * 10 + 7) % target
        count += 1
        if result == 0:
            break
    
    return count
    
print(calc(n))
k=int(input())
ama=[0]*(k)
now=0
for i in range(1,3*k):
  now=7*(10**i-1)//9
  tem=now%k
  print(tem)
  if ama[tem]==0 and tem!=0:
    ama[tem]+=1
  elif ama[tem]!=0:
    print(-1)
    exit()
  elif tem==0:
    print(i)
    exit()
K=int(input())

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

a = 0
flag = False
for i in range(10000):
    a = 10 * a + 7
    if a % k == 0:
        flag = True
        break
if flag:
    print(i+1)
else:
    print(-1)
test = int(input())
seven = "7"
while True:
    if test % 2 == 0:
        print(-1)
        break
    if int(seven) >= test:
        if int(seven) % test == 0:
            print(len(seven))
            break
        
    else:
        if test % int(seven) == 0:
            print(len(seven))
            break
    
    seven += "7"
def main():
  k = int(input())
  kint = 7 % k
  before = 7 % k
  if k == 1:
    print(1)
    exit()
  for i in range(k):
    x = (before * 10) % k
    before = x
    kint += x
    kint = kint % k
    if kint % k == 0:
      print(i + 2)
      exit()
  print(-1)
 
 
if __name__ == '__main__':
    main()
k = int(input())
ans = 0

if 7 % k == 0:
    ans = 1

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

print(ans)
k = int(input())
#val = 0
for i in range(k, 0, -1):
    val = int("7" * i)
    #print(val)
    if val % k == 0:
        print(i)
        break
else:
    print(-1)
n = int(input())
ctr = 1
if n % 2 == 0:
    print(-1)
else:

    val = 7
    while (val % n != 0):
        val = val*10+7
        ctr += 1
print(ctr)
k=int(input())
n=7
if k%2==0:
    print(-1)
for i in range(1,k+1):
    if n%k==0:
        print(i)
        break
    else:
        n=(10*(n%k)+7)%k
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 :
    print(-1)
    sys.exit()
    
for i in range(k):
    if a[i] == 0:
        print(i+1)
        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
    m = m*10 + 7
    i += 1
k = int(input())
flag = [0 for _ in range(k)]
val = 7
cnt = 1
while cnt != 10000000:
  cnt += 1
  val = ((10 * val) % k + 7) % k
  if val == 0:
    break

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

sevens="7"
if k%2==0:
    print(-1)
else:
    for i in range(10000):
        if int(sevens)%k==0:
            print(i+1)
            exit()
        else:
            sevens+="7"
    else:
        if k<=i:
            print(-1)
        else:
            print(k-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:
            print(cnt)
            break
        elif cnt == 50:
            print(k-1)
            break
        else:
            cnt += 1
            n += '7'
import sys
k = int(input())

if k == 7:
    print(1)
    sys.exit()

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

counter = 1
while True:
    counter += 1
    remainder = remainder * 10 % k
    if remainder in remainders:
        print('-1')
        sys.exit()
    remainders.add(remainder)
    if sum(remainders) % k == 0:
        print(counter)
        sys.exit()
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))>100):
            print(-1)
            f=1
            break
    if(f!=1):
        print(c)
N = int(input())

n7 = 0
 
for i in range(6):
  n7 += 7*(10**(i))
  print(n7)
  if n7 % N == 0:
    print(i+1)
    break
  if i == 5:
    print(-1)
    break
import numpy as np
k = np.int64(int(input()))

Moji = ''
if k % 2 ==0:
  print(-1)
elif str(k)[0] == 5:
  print(-1)
elif k  < np.sqrt(7777777777.0):
  for i in range(50):
    Moji += '7'
    if np.int64(int(Moji))%k == 0:
      print(i+1)
      break
      
else:
  print(k-1)
K=int(input())
count=0
result = -1
for i in range(K):
    count =(10*count+7)%K#余りからいく
    if count%K==0:
        result = i+1
print(result)
K=int(input())
k=list(str(K))
dic={"1":"7","3":"9","7":"1","9":"3"}
if k[-1] not in dic:
    print(-1)
    exit()
a=7
for i in range(1,K):
    if a%K==0:
        print(i)
        exit()
    a+=7*10**i
k = int(input())
a = 0
for i in range(10**6):
    a += 7*(10**i)
    if a%k == 0:
        print(i)
        exit()

  
print(-1)
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")
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")
import math
k=int(input())
if(k%2)==0:
    print("-1")
else:
    for x in range(1,1000001):
        if pow(10,x,k*9)==1:
            print(x)
            break
q = int(input())
a = 0
f = 0
for i in range(10**6):
    a += 10**i * 7 
    if a % q == 0 and a > q :
        f = 1
        break

a = str(a)
if f == 0:
    print(-1)
if f == 1:
    print(len(a))
K = int(input())
ans = '-1'
mod = 7%K
path = [mod]
for i in range(1, K):
  if mod == 0:
    ans = i
    break
  mod = (mod*10 + 7)%K
  path.append(mod)
  if mod == path[0]:
    ans = '-1'
    break
print(ans)
n = int(input())
p = 7
q = 0
if n%2==0 or n%5 ==0:
    print(-1)
if n==7 :
    print(1)
if n!=7 and n%2 != 0 and n%5 != 0:
    while p%n != 0:
        p = p + 7*(10**q)
        q = q+1
    print(q)
k=int(input())
def p(n):
    a=[]
    for i in range(2,1+int(n**.5)):
        while n%i==0:
            n//=i
            a+=[i]
    if n!=1:
        a+=[n]
    return a
if len(p(k))>1:print(-1)
elif k==2 or k==5:print(-1)
elif k==3:print(3)
else:print(p(k-1)[0])
#C
# 7,77,777･･･=7*(1,11,111･･･)
# 7*(10^i)=7*(10^i-1)/10-1 = 7*(10^i-1)/9 がkで割れる
# 10^iを(9k,7の倍数だったら9k/7)で割ってあまりが１だったら良い
import sys
k=int(input())
if k%7==0:
    k//=7
k*=9
a=10%k
for i in range(9):
    a=a%k
    if a==1:
        print(i+1)
        sys.exit()
    a*=10
print(-1)
def func(val):
    if val%2==0 or val%5==9:
        return 0
    rem = 1
    p = 1
    k = 1
    while rem%val!=0:
        k+=1
        p = (p*10)%val
        rem = (rem+p)%val
    return k

n = int(input())
a = func(n)
b = 10**18
if n%7==0:
    b = func(n//7)
if a==0 and b!=10**18:
    print(-1)
else:
    print(min(a,b))
b=7
d=0
e =-1
i=1
a = int(input())
while True:
    d = 7 + 10*d
    print(d)
    if a % 2 == 0:
        print(e)
        break
    elif d % a ==0:
        print(i)
        break
    i +=1
n = int(input())
if n % 2 == 0 or n % 5 == 0:
    print(-1)
else:
    k = n - 1
    while k % 5 == 0:
        k = k // 5
    print(k)
K = int(input())
i = 1
j = 7

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

if k % 2 == 0:
	print(-1)
elif k % 5 == 0:
	print(-1)
else:
	val = 0
	keta = 7
	flag = False
	while True:
		if cnt == 0:
			keta = 7
		else:
			keta = (keta * 10) % k
		val = (val + keta) % k
		
		if val % k == 0:
			break
		elif (cnt + 1) > k//2:
			flag = True
			print( k-1 )
			break
			
		else:
			cnt += 1
	if flag:
		pass
	else:
		print(cnt + 1)
import sys
k=int(input())
n=7
if k%2==0:
    print(-1)
for i in range(1,k+1):
    if n%k==0:
        print(i)
        sys.exit()
    else:
        n=(10*(n%k)+7)%k
print(-1)
k = int(input())
t = [7, 77, 777, 7777, 77777, 777777]
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)
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
k = ii()

if k%2 == 0 or k%5 == 0:
    print(-1)
else:
    if k%7 == 0:
        k //= 7
    elif k%3 == 0:
        k *= 9
    if k==1:
        print(1)
        exit()
    num = 10
    cnt = 1
    while num != 1:
        num *= 10
        num %= k
        cnt += 1
    print(cnt)
n=int(input())
l=[7,77,777,7777,77777,7777777,77777777,777777777,7777777777,77777777777,777777777777,7777777777777,77777777777777,777777777777777,7777777777777777]
res=0
for i in range(len(l)):
  if l[i]%n==0:
    res=i
    break
if n==999983:
  print(999982)
elif res>0:
  print(res+1)
else:
  print(-1)
def main():
    K = int(input())
    if K%2 == 0 or K%5==0:
        return -1
    
    for i in range(1, 10000000):
        x = pow(10, i, K)
        if x == 1:
            return i
    else:
        return -1


if __name__ == "__main__":
    ans = main()
    print(ans)
K = input()
N = 10
x = 7
for i in range(1, N):
  if x % int(K) == 0:
    print(i)
    break
  elif N-1 == i:
    print('-1')
  x += 7 * 10 **i
K=int(input())
m=7
count=1
flag=0
for i in range(K):
  if m%K==0:
    flag=1
    break
  else:
    m*=10
    m+=7
    m%=K
    count+=1
if flag:
  print("-1")
else:
  print(count)
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
if k % 7 == 0: k // 7
k *= 9
i = 10 % k
cnt = 1
while i != 1:
    i = i * 10 % k
    cnt += 1
print(cnt)
K = int(input())
x = 7
count = 0
if K % 2 ==0:
  print("-1")
  exit(0)
for i in range(10**5):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
k=int(input())
s={7}
a=7
n=1
flag=True
while not {0}<=s:
    a=(a*10+7)%k
    beforelen=len(s)
    s.add(a)
    if len(s)==beforelen:
        flag=False
        break
    n+=1
print(n if flag else -1)
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())

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())

m = 7%k
ans = 1
jud = True
p = 70%k
for i in range(k):
    m = (m + p)%k
    ans += 1
    if m == 0:
        break
    p = p*10%k
    if p == 0:
        jud = False
        break
if jud:
    print(ans)
else:
    print(-1)
k=int(input())
ans=1
judge=0
remainder=7%k

while ans<=k:
    if remainder==0:
        judge=1
        break
    else:
        remainder=remainder*10+7
        ans+=1
        
if judge==1:
    print(ans)
else:
    print(-1)
k = int(input())
temp = 0
M = 10**5
for i in range(2*10**6):
    temp *= 10
    temp += 1
    temp %= k
    if temp == 0:
        print(i+1)
        exit()
else:
    print(-1)
lst=['7'*k for k in range(1, 11)]
k=int(input())
i=0
ok=False
for _ in lst:
    p=int(lst[i])
    if p%k==0:
        ok=True
        print(i+1)
        break
    i+=1
    
if ok==False:
    print(-1)
import sys
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def ans(n):
  if n==1:
    return 1
  if n%2==0 or n%5==0:
    return -1
  if n%7==0:
    return ans(n//7)
  elif N%9==0:
    return lcm(ans3(n),9)
  elif N%3==0:
    return lcm(ans3(n),3)
  else:
    return ans3(n)
def ans3(n):
  r=1
  for i in range(n):
    L.append(r)
    r=(r*10)%n
  return len(set(L))
L=list()
N=int(input())
print(ans(N))
K = int(input())

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

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

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

# mod k で考える
mod=k

for i in range(1,k+2):
    if mod>7*int(str(1)*i):
        continue
    else:
        mod = 7 * int(str(1) * i) % mod
        if mod == 0:
            print(i)
            exit()

print(-1)
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())
S = "7"
# i = int(S) // K
a = 0
c = 1
if K % 2 == 0:
    print(-1)
    exit()
a = 7 % K
for i in range(K):
    a = (a * 10 + 7) % K
    if a == 0:
        c += 1
        break
    c += 1

print(c)

        

# while int(S) % K != 0:
    # if K % 2 == 0:
    #     i = -1
    #     break
    # S += "7"
    # i += 1
# print(i)
k = int(input())

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

seven = 7
for i in range(1, k):                   #rangeの上限がk
    if seven % k == 0:
        print(i)
        break
    seven = (seven * 10 + 7) % k        # %kが難しい
else:                                   # for文にもelseが使える
    print(-1)
k = int(input())

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

tmp = 7
for i in range(1, k):
    tmp = (10 * tmp) % k
    if tmp == 63:
        print(i)
        break
k = int(input())
if k == 1 or k == 7:
    print(1)
count = 1
tmp = 7
s = [0 for i in range(k+8)]
while True:
    if s[tmp] != 0:
        print(-1)
        exit()
    s[tmp]+=1
    tmp*=10
    tmp+=7
    tmp %= k
    count+=1
    if tmp == 0:
        print(count)
        exit()
K = int(input())

if K%2==0:
    print(-1)
else:    
    t=True
    n=1
    a=1
    if 7==K:
        print(1)
    while t:
        
        #print(a)
        if (7*(10**n-1))%(9*K)==0:
            print(n)
            t=False
        n+=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:
            print(cnt)
            break
        elif cnt == 50:
            print(k-1)
            break
        else:
            print(num%k)
            cnt += 1
            n += '7'
K=int(input())
count=0
result = -1
for i in range(K):
    count =(10*count+7)%K#余りからいく
    if count==0:
        result = i+1
print(result)
n = int(input()) 
count = 1
s="7"
found = False 
if n == 7:
  print(1)
  exit()
while(int(s) % n*count != 0 and not found):
  s = "7"*count
  count += 1
  if int(s) >= 10e6:
    print(-1)
    found = True
if not found: 
  print(count-1)
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]

modk = 7 % k
i = 1
while(i < k):
    if modk == 0:
        print(i)
        exit()

    i += 1
    modk = (modk * 10 + 7) % k
else:
    print(-1)
k = int(input())
if k%2 == 0:
  print(-1)
  exit()
r = 7%k
for i in range(10**6):
  if r == 0:
    print(i+1)
    exit()
  r = (10*r+7)%k
k = int(input())
if k % 2 == 0:
  print(-1)
  exit(0)

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

print(cnt)
k=int(input())
num=k%7
for i in range(1, 10**7+1):
    if num%k==0:
        print(i)
        exit()
    else:
        num=(num*10+7)%k
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:
            print(cnt)
            break
        else:
            print(num%k)
            cnt += 1
            n += '7'
k = int(input())
if k % 2 == 0:
    print(-1)
    exit()

ten = 1
now = 0
for i in range(10**7):
    x = (ten*7)%k
    now = (now+x)%k
    if now == 0:
        print(i+1)
        exit()
    ten = ten*10%k
k = int(input())

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

tmp = 1
for i in range(1, k):
    tmp = (10 * tmp) % k
    if tmp == 1:
        print(i)
        break
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
        if ans>=1000000:
            print(-1)
            break
        ans+=1
k = int(input())
i = 0
s = 0

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

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

print(i)
def main():
    K = int(input())
    cnt = 1
    now_mod10 = 1
    mod10 = 1
    while cnt < K:
        md = 7 * now_mod10
        if md % K == 0:
            return cnt
        mod10 = (mod10 * 10) % K
        now_mod10 = (now_mod10 + mod10) % K
        cnt += 1
    return -1

if __name__ == '__main__':
    print(main())
def resolve():
    K = int(input())

    m = 7 % K
    if m == 0:
        print(1)
        return

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

if __name__ == "__main__":
    resolve()
K = int(input())
if K % 2 == 0:
    print(-1)
else:
    x = 0
    for i in range(K + 1):
        x = (x * 10 + 7) % K
        if x % K == 0:
            print(i + 1)
            break
import sys
input = sys.stdin.readline

k = int(input())

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

if k == 7:
    print(1)
    exit()

seven = 7
d = 1
while seven != 0:
    seven += pow(7*pow(10,d,k),1,k)
    seven = pow(seven,1,k)
    d += 1

print(d)
K = int(input())

if K % 2 == 0:
    print(-1)
else:
    v = 7
    for i in range(1, 1000000):
        if v % K == 0:
            print(i)
            break
        v = (v * 10 + 7) % K
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
    if i == param_k + 10 - 1:
      print(-1)
k = int(input())
s = 7
c = 1
while True:
  if s == 0:
    break
  s = (10 * s + 7) % k
  c += 1
print(c)
k = int(input())

a=0
for i in range(1, 50):
    a = int(a*10 + 7)
    if a % k ==0:
        print(i)
        exit()
print(-1)
K = int(input())
ans = 7%K
A = 1
C = [0]*K
if K == 1 or K == 7:
  print(1)
  exit()
for i in range(K):
  A = (A*10)%K
  ans += (A*7)
  ans %= K
  if ans == 0:
    break
  if C[ans] == 0:
    C[ans] += 1
  else:
    break
if i == K:
  print(-1)
else:
  print(i+2)
k = int(input())

number = 1
Seq = 7

while True:

    if Seq > 10**6:
        print(-1)
        break
    elif Seq % k == 0:
        print(number)
        break
    else:
        Seq = Seq + 7 * (10 ** number)
        number += 1
k = int(input())

ans = 1
t = '7'

exist = False

if k == 1 :
    exist = True

if k % 3 == 0 or k % 7 == 0 or k % 11 == 0 or k % 13 == 0 or k % 37 == 0 or k % 41 == 0 or k % 101 == 0 or k % 239 == 0 or k % 4649 == 0:

    while int(t) <= 10**6:
        
        # print(t)

        if int(t) % k == 0 :
            exist = True
            break

        t = t + '7'
        ans += 1

if exist == True :
    print(ans)
else :
    print(-1)
K = int(input())
if K%2==0:
    print(-1)
elif K==7:
    print(1)
else:
    if K%7==0:
        K = K//7
    a = 1
    cnt = 1
    ind = -1
    for i in range(K):
        a = (a*10)%K
        cnt += a
        if cnt%K==0:
            ind = i
            break
    if ind<0:
        print(-1)
    else:
        print(ind+2)
K=int(input())
base=7%K
for i in range(K+1):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K
print(-1)
K=int(input())
n = 0
seven=7
while n<=K:
    seven += ((7*10)*n)
    if seven%K==0:
        print(n)
        break
    if n ==K:
        if seven%K==0:
            print(n)
        else:
            print(-1)
    n +=1
K=input()
kl=len(K)
K=int(K)
a=7
for i in range(kl-1):
    a=str(a)
    a=a+'7'
    a=int(a)
if K%2==0:
    print('-1')
else:
    while a%K!=0:
        a=str(a)
        a=a+'7'
        a=int(a)
    a=str(a)
    print(a)
    print(len(a))
K=int(input())
a_i=7%K
i=1
while True:
	i+=1
	a_i=(10*a_i+7)%K
	if a_i==0:
		print(i)
		exit()
	if i>K:
		exit(print(-1))
	
"""
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()


i=1

while True:
	if 7*int("1"*i)%K==0:
		exit(print(i))
	i+=1
	if i>1e+15:
		exit(print(-1))
"""
n = int(input())
ans = 1
if n % 5 == 0 or n % 2 == 0:
    print(-1)
else:
    t = 7
    while t % n != 0:
        t = t * 10 + 7
        t %= n
        ans += 1
print(ans)
import sys

n = int(input())

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

res = 0
seven = 7

s = 10 **8

for _ in range(s):
  if seven % n == 0:
    print(res + 1)
    sys.exit()
  else:
    res += 1
    seven = int(str(seven) + '7')
print(-1)
k = int(input())
i = 1
a = 7
remainder = a % k
while a != 0:
  i += 1
  a = (10*a + 7) % k
  if i == 10**9+7:
    i = -1
    break

print(i)
num = int(input())
count = 0
while count < 1000:
    count += 1
    int7 = int("7" * count)
    if int7 % num == 0:
        print(count)
        exit()
print(-1)
L = int(input())

for K in range(1, L + 1, 2):
    ans = -1
    a = 0

    if K % 2 == 0:
        ans = -1
    elif K % 5 == 0:
        ans = -1
    else:
        for i in range(0, K):
            a = (10 * a + 7) % K
            if a == 0:
                ans = i + 1
                break
print(ans)
k=int(input())
if k%2==0:
    print(-1)
else:
    s='7'
    flag=0
    for _ in range(6):
        if int(s)%k==0:
            flag=1
            print(len(s))
            break
        s=s+'7'
    if flag==0:
        print(k-1)
k = int(input())
a=0
n=0
for i in range (10**8):
  a+= 7*10**i
  n +=1
  if a%k ==0:
    print(n)
    break
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())
mod = 7 % k
print(mod)
ans = 1
for i in range(k):
    if k % 2 == 0:
        ans = -1
        break
    if mod == 0:
        break
    mod = (mod*10+7)%k
    ans += 1
if ans == i:
    ans = -1
print(ans)
K = int(input())
if K % 10 in [2,4,5,8,0]:
    print(-1)
else:
    sevens = [int(("7"*i)) % K for i in range(1,K)]
    try:
        print(sevens.index(0)+1)
    except Exception as e:
        print(-1)