peterverebics/CodeNet_Python_118 huggingface dataset:
K = int(input())
f = 1
j = 7 % K
while f < K and j != 0:
    j = (j * 10 + 7) % K
    f += 1
if j == 0:
    print(f)
else:
    print('-1')
K = int(input())
a = 7 % K
mods = []

i = 0
found = False
while (i <= K):
    i += 1
    if a == 0:
        print(i)
        found = True
        break
    a = (10 * a + 7) % K

if not found:
    print(-1)
k=int(input())
k *= 9
amari = 63
for i in range(1, 10 ** 6 + 1):
  amari %= k
  if amari == 0:
    print(i)
    break
  else:
    amari = amari * 10 + 63
else:
  print(-1)
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

#check = [int(("1"*i))*7 for i in range(10**6 + 2)]
#print(check)
n = int(input())
temp = 7
for i in range(1,10**7):
	#print(temp)
	if temp%n == 0:
		print(i)
		exit()
	else:
		temp = ((temp*10) + 7)%n
print(-1)
import sys
k = int(input())

def a(n):
    t = n * 10 + 7
    return t % k

a_i = 7
i = 1
if a_i % k == 0:
    print(i)
    sys.exit()

for j in range(k+1):
    a_i = a(a_i)
    i += 1
    if a_i % k == 0:
        print(i)
        sys.exit()
print(-1)
k = int(input())

answer = -1
x = 7
for index in range(k) :
  if x % k == 0:
    answer = index + 1
    break
  x = (10 * x + 7) % k
  
print(answer)
K = int(input())
ans = -1
N = 7
for i in range(K):
    if N % K == 0:
        ans = i+1
        break
    N = (N*10+7) % K
print(ans)
K=int(input())
if K%2==0 or K%5==0:
    print(-1)
    exit()
if K==7 or K==1:
    print(1)
    exit()
if K==3:
    print(3)
s=7%K
for i in range(1000001):
    tmp=(10*(K-s))%K
    s=K-tmp+7
    #print(s)
    if s==0 or s==K:
        print(i+2)
        exit()
K=int(input())
i=1
x=7
mod=set()
while True:
  if x%K==0:
    print(i)
    break
  else:
    if x%K in mod:
      print(-1)
      break
    mod.add(x%K)
    x=(x%K)*10+7
    i+=1
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  k = int(input())
  a = 0
  for i in range(k):
    a = (10 * a + 7) % k
    if a == 0:
      print(i+1)
      return 
  print(-1)
  
if __name__=='__main__':
  main()
K = int(input())

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

else:
    print('-1')
k=int(input())
num=0
for i in range(k):
    num*=10
    num+=7
    num %= k
    # print(num)
    if num==0:
        print(i+1)
        break
else:print(-1)
n=int(input())

sm=0
work=7
for i in range(1,5*n):
    sm+=work
    while sm>=n:
        sm-=n
    if sm==0 :
        print(i)
        break
    work*=10
    work%=n
else : print(-1)
k = int(input())
t = 7
ans=0

for i in range(k):
    if t%k==0:
        ans =i+1
        break
    else:
        t = (t*10+7)%k
        
print(ans if ans >0 else -1)
# C TLE
# -*- coding: utf-8 -*-
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    num = 7
    for i in range(10 ** 6):
        mod_num = num % K
        if mod_num == 0:
            print(i + 1)
            break
        num = mod_num * 10 + 7
import sys

K = int(input())

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

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

print("-1")
sys.exit()
K = int(input())

for i in range(K):
    if i == 0:
        N= 7%K
    else:
        N = (10*N+7)%K
    if N == 0:
        print(i+1)
        break
else:
    print(-1)
# -*- coding: utf-8 -*-
k = int(input())

r = 0
c = 0
for i in range(1, 1000001):
    r *= 10
    r += 7
    c += 1

    r %= k
    if r == 0:
        break

if r != 0:
    print(-1)
else:
    print(c)
k = int(input())

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

print(-1)
k = int(input())
a = [7 % k]
if 7 % k == 0:
    print(1)
    exit()
for i in range(1,k):
    tmp = (a[-1] * 10 +7) % k
    if tmp == 0:
        print(i+1)
        exit()
    else:
        a.append(tmp)
print('-1')
K = int(input())

now = 0
for i in range(K):
    now = ((now*10)+7)%K
    if now == 0:
        print(i+1)
        break
else:
    print(-1)
K=int(input())
ans=-1
num=0
for i in range(K):
    # num += 7*(10**i)
    # if num % K == 0:
    #ってすると計算量がやばいので
    num = (10*num+7) % K
    if num == 0:
        ans = i+1
        break
print(ans)
k = int(input())
ans = -1
a = [7%k] * k
for i in range(k - 1):
    a[i + 1] = (10*a[i] + 7) % k
for i in range(k):
    if a[i] == 0:
        ans = i + 1
        break
print(ans)
k = int(input())

now = 7

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

i = 7 % k
cnt = 1
while i != 0:
    i = i * 10 + 7
    i %= k
    cnt += 1
print(cnt)
k = int(input())
ans = -1
prev = 0
for i in range(1, k + 1):
    prev = (10 * prev + 7) % k
    if prev == 0:
        ans = i
        break
print(ans)
k=int(input())
num = 0
ans = -1
for i in range(k):
  num = (10*num+7)%k
  if num==0:
    ans = i+1
    break
print(ans)
k=int(input())
n=7
f=0
if k%2==0:
    f=0    
else:
    for i in range(1000000):
        if n%k==0:
            f=1
            break
        n=n*10+7
        n%=k
if f:
    print(i+1)
else:
    print(-1)
K = int(input())

a = 7
flag = False

for i in range(1,K+1):
  b = a%K
  if b==0:
    flag = True
    break
  a = b*10 + 7
if flag:
  print(i)
else:
  print(-1)
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()
i, ai = 0, 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
      break
print(i)
import sys

k = int(input())

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

rest = [7 % k]


for i in range(k):
    rest.append(rest[-1] * 10 % k)

tmp = 0
for i in range(k):
    if (tmp + rest[i]) % k == 0:
        print(i + 1)
        sys.exit()
    else:
        tmp = (tmp + rest[i]) % k
else:
    print(-1)
import math as mt
n=int(input())
x=7%n
ten=1
for i in range(n):
  if x%n==0:
    print(i+1)
    break
  ten=((ten%n)*(10%n))%n
  x+=((ten%n)*(7%n))%n
else:
  if n==1:
    print(1)
  else:
    print(-1)
K = int(input())
ans = 1
count = 1
m = 10
if K%7 == 0:
  K //= 7
for j in range(K):
  if count % K == 0:
    print(ans)
    exit()
  else:
    count = (count + m)%K
    m = m*10%K
    ans += 1
print(-1)
# coding: utf-8

k = int(input())
n = 7 % k

for i in range(k+1):
    if n % k == 0:
        print(i+1)
        exit(0)
    n = (((n % k) * (10 % k)) + 7 % k) % k
print(-1)
k=int(input())
num=0
for i in range(k+1):
    num=(num*10+7)%k
    if num==0:
        print(i+1)
        break
if num:
    print("-1")
import sys 
K = int(input())
if K%5==0 or K%2==0:
    print("-1")
    sys.exit()

A = 0
for i in range(K):
    A = (10 * A + 7) % K
    if A == 0:
        print(i+1)
        break
import sys
input = sys.stdin.readline

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

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

main()
import sys
K = int(input())

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

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

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

i = 1
mod = 10**i % L
while True:
    if mod == 1:
        print(i)
        sys.exit()

    mod = mod * 10 % L
    i += 1
k = int(input())
count = 1
n = 0
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
  while 1:
      n = (n * 10 + 7) % k  
      if n == 0:
        break 
      count += 1
  print(count)
K=int(input())
mod=9*K
n=1
if K%7==0:
  mod=mod//7
for i in range(1,K+1):
  n=n*10%mod
  if n==1:
    print(i)
    exit()
print(-1)
K=int(input())
if K%5==0 or K%2==0:
    print(-1)
if K%7==0:
    L=9*K//7
else:
    L=9*K
R=1
for i in range(L):
    R=R*10
    R=R%L
    if R==1:
        print(i+1)
        exit()
k=int(input())
mod=0
ans=0
for i in range(1000000):
    ans+=1
    mod=(mod*10+7)%k

    if mod==0:
        break
print(ans if ans!=1000000 else -1)
K = int(input())

a = [0]*(K+1)
a[0] = 7%K
ans = -1
for i in range(K):
    if(a[i]==0):
        ans = i+1
        break
    a[i+1] = (10*a[i]+7)%K
print(ans)
#coding:utf-8

k = int(input())

now = 1

if(k%2==0)or(k%5==0):
    print("-1")
else:
    past = 0
    for i in range(1,k+1):
        past = (past * 10 + 7) % k
        if past == 0:
            print("{}".format(i))
            break
K = int(input())

ans = -1
mod = 0

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

print(ans)
K = int(input())

p = 0
res = -1
for i in range(10 ** 6):
    p *= 10
    p += 7
    p %= K
    if p == 0:
        res = i + 1
        break

print(res)
K = int(input())

f=0
n=K

for i in range(10**6 + 1):
    if n == 0:
        f=1
        print(i)
        break
    n = ((n*10) + 7 ) % K
    
if f==0:
   print(-1)
from math import gcd

x=int(input())
if gcd(x,10)!=1:
    print(-1)
    exit(0)

n=7
res=1
while n%x!=0:
    res+=1
    n*=10
    n+=7
    n%=x

print(res)
import sys
input=sys.stdin.readline

k=int(input())
if k%7==0:
    k=k//7
if k==1:
    now=0
else:
    now=1
s=now
for i in range(k+100):
    if s==0:
        print(i+1)
        sys.exit()
    now=(now*10)%k
    s+=now
    s=s%k
print(-1)
K=int(input())
S=7
t=S%K
u=1
import sys
for i in range(K+1):
  if t==0:
    print (i+1)
    sys.exit()
  else:
    u=(u*10)%K
    t=(t+(7*u))%K
print (-1)
def main():
    k = int(input())
    seven = 7
    already = set()
    cnt = 0
    if k%2==0:
        print(-1)
        return 
    while seven != 0:
        if seven in already:
            print(-1)
            return 
        seven %= k
        already.add(seven)
        cnt += 1 
        if seven != 0:
            seven = seven * 10 + 7
    print(cnt)
    return

if __name__ == '__main__':
    main()
k = int(input())
#k, x = map(int, input().split())
#al = list(map(int, input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

l = (9*k//7) if k % 7 == 0 else 9*k

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

if K == 7:
    print(1)
elif K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    count = 0
    num = 0
    while True:
        num = (num * 10 + 7) % K
        count += 1
        if num == 0:
            print(count)
            break
k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print(-1)
  exit(0)
MOD = k
n = 0
l = []
root = 1
for i in range(1000000):
  n += 7 * root
  n %= k
  if n == 0:
    print(i + 1)
    exit(0)
  root *= 10
  root %= k
print(-1)
K= int(input())

if K%2==0:
    print('-1')
else:
    t=True
    n=1
    a=7
    
    while t:
        if n>K:
            t=False
            print('-1')
        if a%K!=0:
            a=(10*a+7)%K
            n+=1
        else:
            t=False
            print(n)
K= int(input())

visited = set()
remainder = 7
counter = 1

while True:
    remainder = remainder % K
    if remainder in visited:
        print(-1)
        exit()
    if remainder == 0:
        print(counter)
        exit()
    else:
        visited.add(remainder)
        remainder = 10 * remainder + 7
    counter += 1
k=int(input())
mod=k
t=7
for i in range(k):
    if t%mod==0:
        print(i+1)
        exit()
    t%=mod
    t*=10
    t+=7
print(-1)
N=int(input())
x=7%N
for i in range(1,N+1):
    if x==0:
        print(i)
        exit()
    x=(x*10+7)%N
print(-1)
k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    ans = 1
    num = 7
    while True:
        if num % k == 0:
            print(ans)
            break
        else:
            ans += 1
            num += 7 * pow(10, ans - 1, k)
            num %= k
K=int(input())
List = list(str(K))
i = len(List)
tryNum = 7*10**i
res = -1
if K % 2 == 0 or K % 5 == 0:
  print(res)
else:
  flag = True
  mid=0
  K=9*K
  N=0
  while flag:
    N = tryNum % K
    if  N == 7 :
      res = i
      flag = False
    else:
      i += 1
      tryNum= N*10
  print(res)
def solve():
    K = int(input())
    if K % 10 not in [1, 3, 7, 9]:
        print(-1)
        return

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

    print(-1)

solve()
K=int(input())


if K%2==0 or K%5==0:
    print(-1)
    exit()
elif K==7 or K==1:
    print(1)
else:
    M=7%K
    B=7%K
    for i in range(10**7):
        A=((B*10)%K)
        M+=A
        M%=K
        if M==0:
            print(i+2)
            exit()
        B=A+0
        #print(M,B,i)
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 % L
while(ans >= 0):
    if (m == 1):
        break
    m *= 10
    m %= L
    ans += 1
print(ans)
k=int(input())
s={7%k}
a=7%k
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)
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
k=N()
x=7%k
ans=1
for i in range(2*k):
    if x==0:
        print(ans)
        break
    x=x*10+7
    x%=k
    ans+=1
else:
    print(-1)
k = int(input())
seven = 0
i = 0
if k % 2 == 0:
    print(-1)
else:
    while True:
        i += 1
        seven = seven * 10 + 7
        seven = seven % k
        if seven == 0:
            print(i)
            break
        if i>1000000:
            print(-1)
            break
K = int(input())
a = 7%K
ans = -1
for i in range(1,10**6+1):
  if a==0:
    ans = i
    break
  a = (a*10+7)%K
print(ans)
K = int(input())
a = 0
t = 1
for i in range(K):
    a += 7*t
    a = a % K
    t = t*10
    t = t%K
    if a == 0:
        print(i+1)
        exit()
print(-1)
import datetime
import string
import re
import math

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

if K % 2 == 0 or K % 5 == 0:
#解なしのため何もしない
  pass
  
elif 7 % K == 0:
  Ans = 1
  
else:
  pre_modK = 7 % K
  for i in range(2,K+1):
    modK = pre_modK * 10 + 7
    if modK % K == 0:
      Ans = i
      break
    else:
      pre_modK = modK % K

print(Ans)
K=int(input())
ans=-1
count=1
a=7
amari=[0]*K
while 1:
    b=a%K
    if b==0:
        ans=count
        break
    if amari[b]==1:
        break
    amari[b]=1
    count+=1
    a=10*b+7
print(ans)
import math
x = int(input())
rem = 7 % x
cnt = 1
while rem != 0 and cnt <= 1000000:
	rem = (10 * rem + 7) % x
	cnt += 1
if rem == 0:
	print(cnt)
else:
	print(-1)
k = int(input())
i = 7
count = 1
judge = True
for t in range(10**6):
  if i%k == 0:
    judge = False
    break
  count += 1
  i = 10*(i%k)+7
if judge:
  print(-1)
else:
  print(count)
n = int(input())

now_mod = 0

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

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

print(-1)
exit()
K = int(input())
target = 0
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for i in range(1,10**7):
        target = target % K
        target = target*10+7
        if target % K == 0:
            print(i)
            break
k=int(input())
m=0
for i in range(k):
  m=(m*10+7)%k
  if m==0:
    break
  elif i==k-1:
    print(-1)
    exit()
print(i + 1)
K = int(input())
mod = 0
Good = True
for k in range(K):
    mod = (mod * 10 + 7) % K
    if mod == 0:
        print(k+1)
        Good = False
        break
if Good:
    print(-1)
import sys
k = int(input())
a = dict()
cnt = 0
base = 0
while True:
    cnt += 1
    base = (base*10+7)%k
    if base == 0:
        break
    if base in a:
        cnt = -1
        break
    else:
        a[base] = 1
print(cnt)
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)
import sys

K = int(input())
tmp = 0
for i in range(1,10**7):
    tmp = (tmp*10+7)%K
    if tmp == 0:
        print(i)
        sys.exit()
        
print(-1)
K = int(input())
M = 10**6+1

def solve():
    count = 1
    res = 0
    c = 7 % K
    while count < M:
        res = (res * 10) % K
        res = (res + c) % K
        if res == 0:
            return count
        count += 1
    return -1

if __name__ == "__main__":
    print(solve())
K=int(input())

a=7%K
i=1
dp=[0 for n in range(K)]
dp[a]=1

while a!=0:
   a=(10*a+7%K)%K
   if dp[a]==0:
       dp[a]+=1
       i+=1
   else:
       print(-1)
       break
else:
    print(i)
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 == 1 or 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)
def solve(string):
    n, k = 7, int(string)
    if k % 2 == 0 or k % 5 == 0:
        return "-1"
    for i in range(k):
        if not n % k:
            return str(i + 1)
        n = (10 * n + 7) % k


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
'''
Date         : 2020-08-08 23:01:16
Author       : ssyze
Description  : 
'''
from math import *
k = int(input())
x = 7
cnt = 1
while x % k != 0:
    x = (x * 10 + 7) % k
    cnt += 1
    if cnt >= 10**6 + 5:
        break
if cnt >= 10**6 + 5:
    print("-1")
else:
    print(cnt)
K = int(input())
ans = 0
if K % 7== 0:
    K //= 7
#print(K)
for i in range(10**6):
    ans += pow(10,i,K)
    if ans % K == 0:
        print(i+1)
        exit()
print(-1)
n = int(input())
if n % 2 == 0:
  print(-1)
else:
  a = 7
  b = 0
  for i in range(1000000):
    if a % n == 0:
      print(i+1)
      b = 1
      break
    a = (a%n) * 10 + 7
  if b == 0:
    print(-1)
k = int(input())
x = 0
for i in range(1, k + 1):
    x = x * 10 + 7
    if x % k == 0:
        print(i)
        exit()
    x %= k
print(-1)
def solve(K):
    cur = 0
    tens = 1
    for i in range(1_000_001):
        cur += 7 * tens
        cur %= K
        if cur == 0:
            return i + 1
        tens *= 10
        tens %= K
    else:
        return -1


print(solve(int(input())))
K = int(input())

if(K in [1, 7]):
    print(1)
else:
    now = 7 % K
    a = 10 % K
    for n in range(2, 1000001):
        now = (now * a + 7) % K
        if(now == 0):
            print(n)
            break
    else:
        print(-1)
def f(k):
    r = 7%k
    for i in range(k):
        if r == 0: return i+1
        r = (r*10 + 7)%k
    return -1

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

pw=1
tmp=7
ans=1

for _ in range(k):
    if tmp%k==0: 
        break
    ans+=1
    pw*=10
    pw%=k
    tmp+=7*pw
print(ans)
k=int(input())
a=7
for i in range(1,10**6+1):
    if a % k ==0:
        print(i)
        exit()
    a=(10*a+7)%k
print(-1)
k=int(input())
v=[1]*k
if k==1 or k==7:
  print(1)
  exit()
m=7%k
v[m]=0
for i in range(k):
  m=(10*m+7)%k
  if m==0:
    c=i+2
    break
  elif v[m]:
    v[m]=0
  else:
    c=-1
    break
print(c)
K = int(input())
ans = [False for _ in range(K)]
num = 0
p = 7%K
for i in range(K+1):
    num += p
    p = (p*10)%K
    if ans[num%K] == False:
        ans[num%K] = True
    else:
        print("-1")
        break
    if num%K == 0:
        print(i+1)
        break
k = int(input())
cnt = 0
for i in range(k):
  if (cnt := (cnt * 10 + 7) % k) == 0:
    print(i+1)
    exit()
print(-1)
k=int(input())

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

ans=1
num=7
while num%k!=0:
  num=10*num+7
  num%=k
  ans+=1

print(ans)
from sys import stdin
k = int(stdin.readline().rstrip())
num = 7
flag = 0
for i in range(1, k + 1):
    if num % k == 0:
        flag = 1
        break
    num = (num * 10 + 7) % k
if flag == 1:
    print(i)
else:
    print(-1)
k=int(input())
mod7 = 7%k
mod10= 10%k

mod = mod7
mod10times = mod7

if mod%k==0:
    print(1)
else:

    for i in range(2,2000000):
        mod10times = mod10times*mod10%k
        mod = mod10times+mod%k

        if  mod%k==0:
            break

    if i==1999999:
        print(-1)
    else:
        print(i)
k=int(input())
if k%2==0:
    print(-1)
    exit()
def solver(k):
    tmp=7%k
    cnt=1
    while cnt <= k:
        if tmp%k != 0:
            tmp=(tmp*10+7)%k
            cnt+=1
        else:
            return cnt
    return -1
        
print(solver(k))
import sys
N=int(sys.stdin.readline().strip())

a=0
for i in range(10**6):
    a+=7*pow(10,i,N)
    if a%N==0:
        print i+1
        quit()
else:
    print -1
K = int(input())

s = set()
seven = 7
ans = 1
while seven % K != 0:
    seven = seven * 10 + 7
    seven %= K
    if seven in s:
        ans = -1
        break
    s.add(seven)
    ans += 1

print(ans)
K = int(input())

sevens = 0
count = 0
repeat = True

if {K%10} & {0,2,4,5,6,8}:
    count = -1
    repeat = False

while repeat:
    sevens = sevens % K * 10 + 7
    count += 1
    if sevens % K == 0:
        repeat = False

print(count)
import math
t = int(input())
if t%2==0 or t%5==0:
    print(-1)
else:
    i=1
    s=7
    while 1:
 
        if s%t==0:
            print(i)
            break
 
        else:
            i += 1
            s = (s * 10 + 7) % t
            continue
def readinput():
    k=int(input())
    return k

def main(k):
    amari=[0]*k
    r=0
    count=0
    for i in range(1,k+1):
        count+=1
        r=(10*r+7)%k
        if r==0:
            return count
        if amari[r]>0:
            return -1
        amari[r]+=1
    return -1

if __name__=='__main__':
    k=readinput()
    ans=main(k)
    print(ans)
k=int(input())
n=0
for i in range(k):
    n=(10*n+7)%k
    if n%k==0:
        print(i+1)
        break
else:print(-1)
K = int(input())

if K%2 == 0 or K%5 == 0:
    print(-1)
else:
    if K%7 == 0:
        L = 9*K//7
    else:
        L = 9*K
    i = 1
    A = 10
    while i < 9000000:
        re = A%L
        if re == 1:
            print(i)
            break
        else:
            A = re*10
            i += 1
    else:
        print(-1)
k=int(input())

am=7%k
i=1

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

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

def solve():
    val = 0
    for i in range(1, K + 1):
        val = val * 10 + 7
        val = val % K
        if val == 0:
            return i
    
    return -1

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

m = 10

for i in range(k):
    m = m % L
    if m == 1:
        print(i + 1)
        exit()
    else:
        m = m * 10
s = input()
K = int(s)

if ((K & 1 == 0) or (s[-1] == "5")):
  print(-1)
else:
  if K % 7 == 0:
    L = 9 * K / 7
  else:
    L = 9 * K

  i = 1
  r = 10
  while True:
    r = r % L
    if r == 1:
      print(i)
      break
    r *= 10
    i += 1
k=int(input())
temp=7
for i in range(1,k+1):
    if temp%k==0:
        print(i)
        break
    temp=(temp*10+7)%k
else:
    print(-1)
K=int(input())
X=0
for i in range(K+1):
  X=(10*X+7)%K
  if X==0:
    print(i+1)
    exit()
print(-1)
k = int(input())
count = 0
for i in range(1, 10 ** 7):
    count *= 10
    count += 7
    count %= k
    if count == 0:
        print(i)
        exit()
print(-1)
K=int(input())

L=9*K//7 if K%7==0 else 9*K

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

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break