peterverebics/CodeNet_Python_118 huggingface dataset:
k = int(input())

x = 7
e = 10

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

print("-1")
K = int(input())
if K%2==0:
    print("-1")
elif K%5==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())

seen = [0]*(k+1)
rem=0
for i in range(0,k+1):
    rem = (rem*10+7) % k
    # print(rem)
    if rem == 0:
        print(i + 1)
        break
    elif seen[rem] ==1:
        print('-1')
        break
    else:
        seen[rem] =1
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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

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


if __name__ == "__main__":
    main()
k = int(input())
checked = [False] * k

surplus = 0
ans = 1
while 1:
    surplus = ((surplus * 10) + 7) % k
    if checked[surplus]:
        print(-1)
        exit()
    if surplus == 0:
        break
    checked[surplus] = True
    ans += 1

print(ans)
k=int(input())
x=7
for i in range(1,k+1):
  if x%k==0:
    print(i)
    break
  x=(x*10+7)%k
else:
  print(-1)
def resolve():
    K = int(input())
    N = 7
    c = 1
    for i in range(10**6):
        if N % K == 0:
            print(c)
            break
        else:
            N = N * 10 + 7
            N %= K
            c += 1
    else:
        print(-1)
resolve()
import sys
from collections import defaultdict
K = int(input())
n = len(str(K))

r = 7 % K
dict = defaultdict(bool)  # int/bool/list....
dict[r] = True
orgr = r
d = 1
for _ in range(K + 1):
    if r == 0:
        print(d)
        break
    d += 1
    r = (10 * r + 7) % K
    if dict[r]:
        print(-1)
        sys.exit()
    dict[r] = True
import sys
K = int(input())

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

r = set()
x = 7
i = 1
while True:
    rr = x % k
    if rr == 0:
        print(i)
        break
    if rr in r:
        print(-1)
        break
    x = (x * 10 + 7) % k
    i += 1
    r.add(rr)
k = int(input())

m = 0

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

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

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

cnt = 0
n = 7
while cnt <= K:
    cnt += 1
    if n % K == 0:
        break
    n = (10 * n + 7) % K

if cnt == K+1:
    print(-1)
else:
    print(cnt)
k = int(input())
m = [False] * k
s = 0
d = 7 % k
i = 0
while True:
  s = (s + d) % k
  d = d * 10 % k
  i += 1
  if s == 0:
    print(i)
    break
  if m[s]:
    print(-1)
    break
  m[s] = True
k = int(input())

m = 0

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

print(-1)
K=int(input())
if K%2==0 or K%5==0:
    print('-1')
    exit()
a=0
i=1
while True:
    a=(a*10+7)%K
    if a==0:
        print(i)
        break
    i+=1
k = int(input())
seed = 0
flag = 1
for i in range(k):
    seed = (10*seed +7)%k
    if seed == 0: print(i+1); flag = 0; break
if flag: print(-1)
k = int(input())

dp = [0] * k

cur = 0
for i in range(k + 1):
    cur = (cur * 10 + 7) % k
    mod = cur % k
    if mod == 0:
        print(i + 1)
        break
    if dp[mod]:
        print(-1)
        break
    dp[mod] = 1
import math
K = int(input())
if K == 7 or K == 1:
  print(1)
elif math.gcd(K,10) != 1:
  print(-1)
else:
  if K % 7 == 0:
    K //= 7
  cnt = 1
  res = 10
  while True:
    cnt += 1
    res *= 10
    res %= (9 * K)
    if res == 1:
      break
  print(cnt)
def main():

    k = int(input())
    a = [0] * (10 ** 6 + 1)
    a[0] = 7 % k
    if a[0] == 0:
        print(1)
        exit()
    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()
import sys

k = int(input())

if k % 2 == 0 or k % 10 == 5:
    print(-1)
    sys.exit()
else:
    cnt = 1
    a = 0
    while(True):
        a = (a * 10 + 7) % k
        if a % k == 0:
            print(cnt)
            break

        if cnt > 1000000:
            print(-1)
            break

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


K: int = int(input())

print(solution(K))
k = int(input())

x = 7 % k

s = [0] * k
i = 1

while s[x] == 0:
    if x == 0:
        print(i)
        exit()
    s[x] = 1
    x = (x * 10 + 7) % k
    i += 1

print('-1')
#C
K = int(input())
judge=False
num = 7
for i in range(K):
    num = num % K
    #print(num)
    if num == 0:
        print(i+1)
        judge = True
        break
    else:
        num = num*10+7
if judge == False:print("-1")
K = int(input())

if K % 7 == 0:
    K //= 7

L = 9 * K

ans = -1

r = 10

for i in range(L):
    if r % L == 1:
        ans = i + 1
        break
    else:
        r = 10 * (r % L)

print(ans)
K = int(input())
if (K%2==0)or(K%5==0):
  print(-1)
  
else:
  x = 7
  i = 1
  x %= K
  while (x!=0)or(i>=10**7):
    x += (7%K) * pow(10,i,K)
    x %= K
    i += 1
  if i<10**7:  
    print(i)
  else:
    print(-1)
k = int(input())
a = []
a.append(7 % k)

for i in range(k):
    a.append((a[i] * 10 + 7) % k)

for i in range(k):
    if a[i] == 0:
        print(i + 1)
        exit()

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

now = 0
dic = {}

import sys
cnt = 1
while True:

    now = (now * 10 + 7) % K
    if now == 0:
        print (cnt)
        sys.exit()
    elif now in dic:
        print (-1)
        sys.exit()
    else:
        dic[now] = 1
    cnt += 1
k = int(input())

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 7
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 7
      ans %= k

  print(cnt)
K = int(input())
L = 0
if K % 7 == 0:
  L = 9*K//7
else:
  L = 9*K
  
ans = -1
s = 10
for i in range(1,L,1):
  if s % L == 1:
    ans = i
    break
  s = s % L * 10
print(ans)
import sys
input=sys.stdin.readline

def main():
    K = int(input())
    
    if K % 7:
        L = 9*K
    else:
        L = 9*K//7
    a = 1
    for i in range(1,L+1):
        a = (a * 10) % L
        if a == 1:
            return i
    return -1
ans =main()
print(ans)
K = int(input())

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

ans = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    ans += 1
    if ai % K == 0:
        print(ans)
        exit()
def main():
    k = int(input())
    surplus = 0 
    for i in range(1, k+1):
        surplus *= 10
        surplus += 7
        surplus %= k
        if not surplus:
            print(i)
            return
    print(-1)
            

if __name__ == "__main__":
    main()
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

k = inp()
dt = {}
no = 0
ans = -1
i = 0
while True:
    no = (no*10+7)%k
    if no in dt:
        break
    dt[no] = 1
    #print(dt,no)
    if no == 0:
        ans = i+1
        break
    i += 1
print(ans)
K = input()
K = int(K)

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

print(seven())
K = int(input())

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

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)
k = int(input())

flag = 0
count = len(str(k))

if k % 2 == 0:
  print(-1)
  exit()
  
if str(k)[-1] == '5':
  print(-1)
  exit()

count = len(str(k))
test = int('7' * count)
amari = test % k
while True:
  if amari == 0:
    break
  else:
    amari = (amari * 10 + 7) % k
    count += 1
  
print(count)
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())
i=0
if K%2==0 or K%5==0:
    print('-1')

else:
    for d in range(K):
        i=(10*i+7)%K
        if i==0:
            print(d+1)
            break
K = int(input())
seven = 7
counter = 1
flag = True
for i in range(K):
    if seven % K == 0:
        print(counter)
        flag = False
        break
    seven = (seven * 10 + 7) % K
    counter += 1
if flag:
    print(-1)
k, R, a = int(input()), 7, -1
for i in range(1, k+1):
    if not R%k:
        a = i
        break
    R = (R * 10 + 7) % k
print(a)
K = int(input())

ans = 1
now = 7 % K
isvisited = set()

while now != 0:
    if now in isvisited:
        print(-1)
        exit()
    isvisited.add(now)
    now = (now * 10 + 7) % K
    ans += 1

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

def main():
    K = int(input())
    
    if K%2==0 or K%5==0:
        print(-1)
        return
    
    if K % 7:
        L = 9*K
    else:
        L = 9*K//7
    a = 1
    for i in range(1,K+10):
        a = (a * 10) % L
        if a == 1:
            print(i)
            return
    print(-1)
main()
K = int(input())

N = 0
count = -1

for i in range(K):
    N = (N*10+7)%K
    if N == 0:
        count = i+1
        break
    
print(count)
# C - Repsept
K = int(input())
tmp = 0
ans = -1
for i in range(1,2*K):
    tmp = (10*tmp+7)%K
    if tmp==0:
        ans = i
        break
print(ans)
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
k = ni()

if k%2==0 or k%5==0:
    print(-1)
    exit()
if k%7==0:
    L=9*k//7
else:
    L=9*k
tmp=1
for i in range(1,10**6):
    tmp = tmp*10 %L
    if tmp==1:
        print(i)
        break
else:
    print(-1)
K = int(input())

a = 7 % K

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

print(-1)
K = int(input())
a = 0
ans = -1
for i in range(10**7):
    a = (a*10+7) % K
    if a == 0:
        ans = i+1
        break
print(ans)
K=int(input())
i=1
if K%2==0 or K%5==0:
  print(-1)
elif K%7==0:
  L=9*K/7
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
else:
  L=9*K
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
k = int(input())

def func(k):
    number = 7 % k
    for i in range(k):
        if number == 0:
            return i+1
        number = (10 *number + 7) % k 
    return -1
    
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    print(func(k))
def main():
    k = int(input().strip())
    if k % 2 == 0 or k % 5 == 0:
        print(-1)
        return
    x = 7 % k
    for n in range(1, k + 1):
        if x == 0:
            print(n)
            return
        x = (10 * x + 7) % k

    print(-1)
    return


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

done = set()
i = 0
x = 7
flag = True
while x % K != 0 :
  if not x in done :
    done.add(x)
  else :
    flag = False
    break
  x = (x % K) * 10 + 7
  i += 1
    
if flag :
  print(i + 1)
else :
  print(-1)
def main(k):
    size, res = 1, 7 % k
    while res and size <= k:
        res = (res * 10 + 7) % k
        size += 1
    return -1 if size > k else size


if __name__ == '__main__':
    k = int(input())
    print(main(k))
k=int(input())
ans=1
judge=0
s=7%k
while ans<=k:
    if s==0:
        judge=1
        break
    else:
        s=s*10+7
        s%=k
        ans+=1
if judge==1:
    print(ans)
else:
    print(-1)
K = int(input())

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

    print(cnt)
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)
def calc(k):
  cur = 0
  for i in range(1, 10 ** 7):
    cur *= 10
    cur += 7
    cur %= k
    if cur == 0:
      return i
  return -1

k = int(input())
print(calc(k))
K = int(input())

count = 1
m = 7 % K
s = set()
while 1:
    if m == 0:
        print(count)
        break
    if m in s:
        print(-1)
        break
    count += 1
    s.add(m)
    m = (m * 10 + 7) % K
k = int(input())
now = k
r = 0
for i in range(1, k + 100):
    r = (r * 10 % k + 7) % k
    if r==0:
        print(i)
        exit()
print(-1)
from collections import deque
import sys
input = sys.stdin.readline
 
k = int(input())
n = 7
ans = -1
 
for i in range(10**6): #注意
  if n % k  == 0:
    ans = i+1
    break
  else:
    n =  (n % k) *10 + 7
    
print(ans)
k=int(input())
n=7
for i in range(k+1):
    if n%k==0:
        print(i+1)
        exit()
    n=(10*n+7)%k
print(-1)
K=int(input())
def waru(K):
    a=[]
    if K%2==0 or K%5==0:
        print("-1")
        return
    a.append(7%K)
    for i in range(1,K):
        a.append((10*a[i-1]+7)%K)
    for i in range(K):
        if a[i]==0:
            print(i+1)
            return
    print(-1)
waru(K)
K=int(input())

k_mod=0
for i in range(1,K+1):
  k_mod=(10*k_mod+7)%K
  if k_mod==0:
    print(i)
    break
else:
  print(-1)
#!/usr/bin/env python
# coding: utf-8

# In[40]:


K = int(input())


# In[44]:


if K%2 == 0 or K%5 == 0:
    print(-1)
else:
    if K%7 == 0:
        L = 9*K//7
    else:
        L = 9*K
    ans = -1
    tmp = 0
    for i in range(1,K+1):
        if (10*tmp+9)%L == 0:
            ans = i
            break
        else:
            tmp = (10*tmp+9)%L
    print(ans)


# In[ ]:
k=int(input())

mod=[0]*k
c=7
cnt=1

while True:
    if c%k==0:
        print(cnt)
        break
    
    mod[c%k]=1

    c*=10
    c+=7
    c%=k
    cnt+=1

    if mod[c]==1:
        print(-1)
        break
def main():
    K = int(input())
    
    a_i = 7
    if a_i % K == 0:
        print(1)
        return

    for i in range(2, 10 ** 6+1):
        a_i = a_i * 10 + 7
        if a_i % K == 0:
            print(i)
            return
        a_i %= K
    print(-1)

main()
def main():
    k = int(input())
    tbl = {}
    v = int(0)
    cnt = 0
    while True:
        cnt += 1
        v = 10 * v + 7
        v = v % k

        if v == 0:
            print(cnt)
            break
        elif v in tbl.keys():
            print('-1')
            break
        else:
            tbl[v] = 0


if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline

K=int(input().rstrip('\n'))
if K % 2 ==0:
  print(-1)
else:
  now = 7
  check = 0
  for i in range(1,K+1):
    if now % K ==0:
      print(i)
      check += 1
      break
    else:
      now = now%K
      now = now*10
      now += 7 
  if check ==0:
    print(-1)
import sys
input = sys.stdin.readline

k = int(input())

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

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

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

if k % 5 == 0:
    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())
INF = 10**18

a = [INF] * (K+1)
a[0] = 0

for n in range(1, K+1):
    a[n] = (10 * a[n-1] + 7) % K
    if a[n] == 0:
        print(n)
        break
else:
    print(-1)
K = int(input())
 
num = 0
cnt = 0
ans = -1
 
for i in range(K):
    num = num*10 +7
    cnt += 1
    if num%K != 0:
        num = num%K
    else:
        ans = cnt
        break
    
print(ans)
K=int(input())
num=7
count = 0
checkK = [0 for j in range(K)]
result = ""

flag = True
while(flag):
    count += 1
    if num%K==0:
        flag = False
        result = str(count)
    num = (num*10+7)%K
    checkK[num] += 1
    if checkK[num] == 2:
        flag = False
        result = "-1"
print(result)
K = int(input())
ans = -1
if K%2 == 0:
    pass
elif K%5 == 0:
    pass
else:
    num = 7
    ans = 0
    while True:
        ans += 1
        if num % K == 0:
            break
        else:
            num = (num * 10 + 7)%K
print(ans)
k = int(input())
mod = 7 % k
counter = 1
memo = 1
mod_map = set()
mod_map.add(mod)
while mod != 0:
    mod = ((mod * 10) % k + 7) % k
    if mod not in mod_map:
        mod_map.add(mod)
    else:
        counter = -1
        break
    counter += 1
    if mod == 0:
        break
print(counter)
k = int(input())

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

n = 7
for i in range(1,10**7):
    if n%k == 0:
        print(i)
        break
    else:
        n = (n%k +0.7) *10
k = int(input())
r = 0
for i in range(1, k+1):
    r = (r*10 + 7)%k
    if r == 0:
        print(i)
        exit()
print(-1)
k = int(input())

cnt = 1
mod = 7

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)
def main():
    K = int(input())
    cnt = 1
    a = 7%K
    s = {a}
    for i in range(K):
        if a%K == 0:
            print(cnt)
            return
        a = a*10 + 7
        a = a % K
        if a in s:
            print(-1)
            return
        s.add(a)
        cnt += 1

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

c = 0

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

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

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

if 7%K==0:
    print(1)
else:
    ans = 1
    b = 7%K
    while ans < 10**7+1000:
        b = (b*10+7)%K
        if b == 0:
            print(ans+1)
            break
        else:
            ans += 1
    else:
        print(-1)
K = int(input())

x = 7
for i in range(K):
  if x % K == 0:
    print(i+1)
    exit()
  else:
    x = (10*x + 7) % K
print(-1)
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print('-1')
else:
    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())

mods = [0] * (K+1)
mods[1] = 7 % K

for i in range(2,K+1):
    mods[i] = (mods[i-1] * 10 + 7) % K

for i in range(1,K+1):
    if mods[i] == 0:
        print(i)
        exit(0)    
print(-1)
K = int(input())
base = 0

for count in range(1, K+1):
  num = base*10 + 7
  if (num%K == 0):
    print(count)
    exit()
  else:
    base = num%K
print(-1)
import sys

k = int(input())

ans = [0]*(k+1)
ans[0] = 7 % k

if ans[0] == 0:
    print(1)
    
else:
    for i in range(k):
        ans[i+1] = (ans[i]*10 + 7) % k
        
        if ans[i+1] == 0:
            print(i+2)
            sys.exit()
            
    print(-1)
def main():
    K = int(input())
    visited = [False]*K

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

        if visited[r]:
            print(-1)
            exit()
        
        visited[r] = True
    
    
if __name__ == "__main__":
    main()
k=int(input())
a=7
for i in range(10**6):
    if a%k==0:
        print(i+1)
        exit()
    a=(a*10+7)%k
print(-1)
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
import copy
k = int(input())
#n, d = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

m = 7
for i in range(1, 10 ** 6):
    if m % k == 0:
        print(i)
        sys.exit()

    m *= 10
    m += 7
    if m > k:
        m %= k

print(-1)
k = int(input())
a = 7
if a % k == 0:
  print(1)
  exit()
for i in range(k):
  a = (a * 10 + 7) % k
  if a == 0:
    print(i + 2)
    exit()
print(-1)
x = int(input())
if x % 2 == 0 or x % 5 == 0:
  print(-1)
else:
  s = 1
  m = 7
  
  while m%x != 0:
    n = m % x
    m = n * 10 +7
    s += 1
    
  
  print(s)
k=int(input())
n=0
a=0
ss=0
if k==7:
  print(1)
elif k%2==0:
  print(-1)
elif k%5==0:
  print(-1)
else:
  while a==0:
    n+=1
    ss=10*(ss%k)+7
    if ss%k==0:
      a=1
  if a==1:
    print(n)
  else:
    print(-1)
import sys
K = int(input())

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

dp = 7
ans = 1

while(ans <= 10000000):
    if dp % K == 0:
        print(ans)
        sys.exit()
    ans += 1
    dp = (dp * 10 + 7) % K
k = int(input())
a = 0

for i in range(k + 10):
    a = (a*10 + 7)%k
    if a == 0:
        print(i + 1)
        exit()
print(-1)
# C Repsept

k = int(input())

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

print(-1)
k = int(input())
now = 7
for i in range(1, k+1):
    if int(now) % k == 0:
        print(i)
        break
    now = 10 * now + 7
    now %= k
else:
    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
for i in range(1,K+1):
  if a[i]==0:
    print(i)
    exit()
print(-1)
K = int(input())
num = 7%K
ans = -1
for i in range(K):
    if num%K == 0:
        ans = i+1
        break
    num = (num*10 +7)%K
print(ans)
k=int(input())
if k%2==0 or k%5==0:
    print(-1)
    exit()
count=0
a=0
while True:
    a=(a*10+7)%k
    count+=1
    if a==0:
        print(count)
        exit()
import sys
K=int(input())

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

k_mod=0
seven_k=0
for i in range(1,K+1):
  k_mod=10*k_mod+7
  k_mod%=K
  if k_mod==0:
    print(i)
    break
else:
  print(-1)
K = int(input())

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

s = '7' * len(str(K))
if int(s) < K:
    s += '7'
ans = len(s)
s = int(s)

while True:
    s = s % K
    if s == 0:
        print(ans)
        exit()
    s = s * 10 + 7
    ans += 1
n = int(input())
c,f=0,0
for i in range(1,1000001):
    c=c*10+7
    c=c%n
    if c==0:
        f=1
        print(i)
        break
if f==0:
    print(-1)
def main():
  k = int(input())
  num = 7 % k
  first = num
  ans = 1
  while num != 0:
    ans += 1
    num = (num*10 + 7)%k
    if num == first or ans > 2000000:
      ans = -1
      break
  print(ans)
    
    
if __name__ == "__main__":
  main()
k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ans = 1
    res = 7
    while True:
        if res%k == 0:
            print(ans)
            break
        res = res*10+7
        res %= k
        ans += 1
import time
K=int(input())
mod=7%K

if 7%K==0:
  print(1)
  exit()
ans=1
now=time.time()
while 1:
  ans+=1
  mod=(mod*10+7)%K
  if mod==0:
    print(ans)
    break
  if time.time()-now>=1.8:
    print(-1)
    break
k = int(input())

x = 7
for i in range(1000000):
    x %= k
    if x == 0:
        print(i + 1)
        break
    x = x * 10 + 7
else:
    print(-1)
n=int(input())
if n%2==0:
    print(-1)
else:
    c=1
    k=7
    while 1:
        if k%n==0:
            break
        if c>n:
            c=-1
            break
        k=(k%n)*10+7
        c+=1
        #print(k)
    print(c)
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

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

print(-1)
k = int(input())
ans = -1
seq = [0]

seq.append(7%k)
for i in range(2,k+1):
  seq.append((seq[i-1]*10+7)%k)

for j in range(1,k+1):
  if seq[j] == 0:
    ans = j
    break

print(ans)
k = int(input())
mod = 0
for i in range(1, 10**6):
    mod = ((mod * 10) + 7) % k
    if mod == 0:
        print(i)
        exit()
print(-1)
def main():
    k = int(input())
    num = 1
    n = 7

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

if __name__ == '__main__':
    main()