CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

k = I()
tmp = 0
for i in range(k+1):
    tmp += 7 * pow(10, i, k)
    tmp %= k
    if tmp % k == 0:
        print((i+1))
        quit()
print((-1))

# Optimized solution
#!/usr/bin/env python3
k = int(eval(input()))
x = 0
for i in range(k+1):
    x *= 10
    x %= k
    x += 7
    x %= k
    if x == 0:
        print((i+1))
        break
else:
    print((-1))
# Original solution
K = int(eval(input()))

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

L = 9 * K

ans = -1

r = 10

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

print(ans)

# Optimized solution
def main():
    K = int(eval(input()))
 
    work = 7
 
    answer = -1
    for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
    print(answer)
main()
# Original solution
import sys
K=int(eval(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))

# Optimized solution
K=int(eval(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))
# Original solution
K = int(eval(input()))
dic = {}
x = 0
count = 0
while 1:
    x = (x * 10 + 7) % K
    count += 1
    if x == 0:
        print(count)
        exit()
    if x in dic:
        print((-1))
        exit()
    dic[x] = 1


# Optimized solution
K = int(eval(input()))
x = 0
for i in range(K + 5):
    x = (x * 10 + 7) % K
    if x == 0:
        print((i + 1))
        exit()
print((-1))
# Original solution
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 < 10**6):
    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)


# Optimized solution
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]

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')
# Original solution
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]

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


# Optimized solution
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
for i in range(k):
    if modk == 0:
        print(i+1)
        exit()

    modk = (modk * 10 + 7) % k
else:
    print(-1)
# Original solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(K):
    visited = [False] * K
    p = 7 % K
    for i in range(K):
        if p == 0:
            return i + 1
        if visited[p]:
            return - 1
        visited[p] = True
        p = (p * 10 + 7) % K


def main():
    # parse input
    K = int(input())
    print(solve(K))


# tests
T1 = """
101
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
4
"""
T2 = """
2
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
-1
"""
T3 = """
999983
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
999982
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()


# Optimized solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(K):
    visited = [False] * K
    p = 7 % K
    for i in range(K):
        if p == 0:
            return i + 1
        if visited[p]:
            return - 1
        visited[p] = True
        p = (p * 10 + 7) % K


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


def main():
    # parse input
    K = int(input())
    print(solve(K))


# tests
T1 = """
101
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
4
"""
T2 = """
2
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
-1
"""
T3 = """
999983
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
999982
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()
# Original solution
k = int(eval(input()))

# 解説AC
if k % 2 == 0 or k % 5 == 0:
    print((-1))
    exit()

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


# Optimized solution
def makedivisor(N):  # 約数列挙
    p, upper, lower = 1, [], []
    while p * p <= N:
        if N % p == 0:
            lower.append(p)
            if p * p != N:
                upper.append(N // p)
        p += 1
    return lower + upper[::-1]


def totient(N):  # オイラーのトーシェント関数
    p, phi = 2, N
    while p * p <= N:
        if N % p == 0:
            phi = phi // p * (p - 1)
        while N % p == 0:
            N //= p
        p += 1
    if N > 1:
        phi = phi // N * (N - 1)
    return phi

k = int(eval(input())) * 9

# 解説AC オイラーの定理 O(n**0.5)
if k % 2 == 0 or k % 5 == 0:
    print((-1))
    exit()
if k % 7 == 0:
    k //= 7

cnt = totient(k)
num = makedivisor(cnt)
for i in num:
    if pow(10, i, k) == 1:
        print(i)
        break
# Original solution
k=int(input())
if k%2==0:exit(print(-1))
ans=0
x=k
for i in range(10**9):
  while x%10!=7:x+=k
  x//=10
  if x==0:exit(print(i+1))


# Optimized solution
import time
start=time.time()
k=int(input())
if k%2==0:exit(print(-1))
ans=0
x=k
for i in range(10**9):
  while x%10!=7:
    x+=k
    if time.time()-start>=1.9:exit(print(-1))
  x//=10
  if x==0:exit(print(i+1))
# Original solution
k=int(eval(input()))


def get(k):
    ans=7
    i=1
    while True:
        if ans%k==0:
            return i
        ans=(ans*10+7)%k
        i+=1




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

else:
    print((get(k)))



# Optimized solution
k=int(eval(input()))


def get(k):
    ans=7
    i=1
    while True:
        if ans%k==0:
            return i
        ans=(ans*10+7)%k
        i+=1




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

else:
    print((get(k)))
# Original solution
def calc(k):
    cur = 7 % k
    for i in range(1, 10 ** 7):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1


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

# Optimized solution
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(eval(input()))
print((calc(k)))
# Original solution
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(eval(input()))
print((calc(k)))

# Optimized solution
def calc(k):
    cur = 7 % k
    for i in range(1, k + 1):
        if cur == 0:
            return i
        else:
            cur *= 10
            cur += 7
            cur %= k
    return -1


k = int(eval(input()))
print((calc(k)))
# Original solution
K = int(eval(input()))
count = 1
mod = 7
answer = -1

for _ in range(K):
    if mod % K == 0:
        answer = count
        break
    count += 1
    mod = (mod * 10 + 7) % K

print(answer)

# Optimized solution
K=int(eval(input()))
amari=0
for i in range(K):
    amari = (amari * 10 + 7)% K
    if amari == 0:
        print((i+1))
        break
    if i == (K-1):
        print((-1))
# Original solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()

tmp = 7
ans = 1
p = 1
mo = tmp%K
checked = [0]*(10**6+1)
checked[mo] = 1
while mo != 0:
    mo = mo + 7*pow(10, p, K)
    mo %= K
    p += 1
    if checked[mo]:
        print((-1))
        break
    checked[mo] = 1
else:
    print(p)


# Optimized solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()

tmp = 7
ans = 1
p = 1
mo = tmp%K
checked = [0]*K
checked[mo] = 1
while mo != 0:
    mo = 10*mo + 7
    mo %= K
    p += 1
    if checked[mo]:
        print((-1))
        break
    checked[mo] = 1
else:
    print(p)
# Original solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

K = INT()

tmp = 7
ans = 1
p = 1
mo = tmp%K
checked = [0]*(K+1)
checked[mo] = 1
while mo != 0:
	mo += 7*pow(10, p, K)
	mo %= K
	p += 1
	if checked[mo]:
		print((-1))
		break
	checked[mo] = 1
else:
	print(p)


# Optimized solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

K = INT()

a = 0
for i in range(K):
	a = (a+7*pow(10, i, K))%K
	if a == 0:
		print((i+1))
		break
		
else:
	print((-1))
# Original solution
#200802C
X = int(eval(input()))
L = len(str(X))
#print(L)


Y = 0

for l in range(L):
    Y += 7*10**l
    
flag = 0
for i in range(10000000):
    Y = Y%X
    #print(i)

    if Y == 0:
        ans = L+i
        flag = 1
        break
    else: 
        Z = Y * 10 + 7
        if Z == Y:
            break
        else:
            Y = Z

if flag == 0:
    print("-1")
else:
    print(ans)

        


# Optimized solution
#200802C
X = int(eval(input()))
L = len(str(X))
#print(L)


Y = 0

for l in range(L):
    Y += 7*10**l
    
flag = 0
for i in range(1000000):
    Y = Y%X
    #print(i)

    if Y == 0:
        ans = L+i
        flag = 1
        break
    else: 
        Z = Y * 10 + 7
        if Z == Y:
            break
        else:
            Y = Z

if flag == 0:
    print("-1")
else:
    print(ans)
# Original solution
k=int(eval(input()))
if k%2==0 or k%5==0:
  print("-1")
  quit()
ki=0
for i in range(1,10**6):
  ki=(ki*10+7)%k
  if ki==0:
    print(i)
    quit()
print("-1")


# Optimized solution
k=int(eval(input()))
if k%2==0:
  print("-1")
  quit()
ki=0
for i in range(1,10**6):
  ki=(ki*10+7)%k
  if ki==0:
    print(i)
    quit()
print("-1")
# Original solution
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


def solve():
    K = Scanner.int()
    if K % 2 == 0:
        print((-1))
        return
    X = 7
    cnt = 1

    while True:
        if X % K == 0:
            print(cnt)
            return
        cnt += 1
        X = X * 10 + 7
        X %= K


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


# Optimized solution
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


def solve(K):
    if K % 2 == 0 or K % 5 == 0:
        print((-1))
        return
    X = 7
    cnt = 1
    while True:
        if X % K == 0:
            print(cnt)
            return
        cnt += 1
        X = X * 10 + 7
        X %= K


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    K = Scanner.int()
    solve(K)


if __name__ == "__main__":
    main()
# Original solution
K = int(eval(input()))

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

count = 0
an = 0
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    break
print(count)

# Optimized solution
K = int(eval(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)
# Original solution
def main():
    K = int(input())
    for i in range(1, K+1):
        a = 7*(pow(10, i, 9*K)-1)
        a %= 9*K
        if a == 0:
            return print(i)
    print(-1)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    K = int(eval(input()))
    a = 7
    for i in range(1, K+1):
        if a % K == 0:
            print(i)
            return
        a = a * 10 + 7
        a %= K
    print((-1))


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


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    K = int(eval(input()))
    a = 7 % K
    for i in range(1, K+1):
        if a == 0:
            print(i)
            return
        a = a * 10 + 7
        a %= K
    print((-1))


if __name__ == '__main__':
    main()
# Original solution
K = int(eval(input()))

A = [0]*1000001
A[0] = 7%K
ans = -1

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

for i in range(1000001):
    if A[i]==0:
        ans = i+1
        break
        
print(ans)

# Optimized solution
K = int(eval(input()))

ans = -1
mod = 7%K
for i in range(1000001):
    if mod==0:
        ans = i+1
        break
    else:
        mod = (mod*10+7)%K
        
print(ans)
# Original solution
import sys

input = sys.stdin.readline

k = int(eval(input()))
if k == 7 or k == 1:
    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)

    

        


# Optimized solution
import sys

input = sys.stdin.readline

k = int(eval(input()))
'''if k == 7 or k == 1:
    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)'''
num = 7%k
soln = False
for i in range(1, k+1):
    if num == 0:
        print(i)
        soln = True
        break
    num= (num * 10 + 7) % k
if not soln:
    print((-1))
# Original solution
K = int(eval(input()))
if K % 2 == 0:
    print((-1))
else:
    mod, modt, ans = 7 % K, 7 % K, 1
    while mod != 0:
        modt = (modt * (10 % K)) % K
        mod, ans = (mod + modt) % K, ans + 1
    print(ans)


# Optimized solution
K = int(eval(input()))
if K % 2 == 0 or K % 5 == 0:
    print((-1))
else:
    mod, modt, ans = 7 % K, 7 % K, 1
    while mod != 0:
        modt = (modt * (10 % K)) % K
        mod, ans = (mod + modt) % K, ans + 1
    print(ans)
# Original solution
k = int(eval(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)

# Optimized solution
k = int(eval(input()))
ans = -1
a = 7%k
for i in range(k):
    if a == 0:
        ans = i + 1
        break
    a = (10*a + 7) % k
print(ans)
# Original solution
k=int(eval(input()))
ans='-1'
a=7
for i in range(1,10**6+1):
  if a%k==0:
    ans=i
    break

  a=((10*a)+7)%k
    
print(ans)

# Optimized solution
k=int(eval(input()))
if k%2==0:
  print((-1))
  exit()
  
ans=1
pin=7
mod=k

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

print('-1')
# Original solution
K = int(eval(input()))

val = 7 % K

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

print(ans)

# Optimized solution
K = int(eval(input()))

val = 7 % K

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

print(ans)
# Original solution
import sys
input = sys.stdin.readline

k = int(eval(input()))

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

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

if k == 1:
    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)




# Optimized solution
import sys
input = sys.stdin.readline

k = int(eval(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)
# Original solution
from itertools import count

k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
    print((-1))
else:
    m = 0
    for i in count(0):
        m += pow(10, i, k) * 7
        m %= k
        if m == 0:
            print((i+1))
            break


# Optimized solution
k = int(eval(input()))

if k % 2 == 0 or k % 5 == 0:
    print((-1))
else:
    i = 1
    m = 7 % k
    while True:
        if m == 0:
            print(i)
            break
        m = (10 * m + 7) % k
        i += 1
# Original solution
k = int(eval(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

# Optimized solution
k = int(eval(input()))
if k % 2 == 0:
    print((-1))
    exit()

ten = 1
now = 0
for i in range(10**8):
    x = (ten*7)%k
    now = (now+x)%k
    if now == 0:
        print((i+1))
        exit()
    ten = ten*10%k
print((-1))
# Original solution
k = int(eval(input()))
if k%2==0 or k%5==0:
    print('-1')
else:
    from itertools import accumulate
    ac = list(accumulate([7*pow(10, i, k)%k for i in range(999983)]))
    for idx, a in enumerate(ac):
        if a%k == 0:
            print((idx+1))
            break
    else:
        print('-1')

# Optimized solution
k = int(eval(input()))

if k%2==0 or k%5==0:
    print('-1') 
else:
    a = 0
    for i in range(999983):
        a = (a*10+7) % k
        if a == 0:
            print((i+1))
            break
    else:
        print((-1))