Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...

Your task is to print the $k$-th digit of this sequence.


-----Input-----

The first and only line contains integer $k$ ($1 \le k \le 10000$) — the position to process ($1$-based index).


-----Output-----

Print the $k$-th digit of the resulting infinite sequence.


-----Examples-----
Input
7

Output
7

Input
21

Output
5

Difficulty: EASY

Solutions:
n = int(input())
step = 9
count = 0
digit = 1
while count + digit * step < n:
	count += digit * step
	step *= 10
	digit += 1
i = n - count
k = int((i + (digit - 1)) / digit)
num = 10 ** (digit - 1) + (k - 1)
j = digit - (i + digit - 1) % digit - 1
while j > 0:
	num = int(num / 10)
	j -= 1
print(num % 10)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input()) - 1
(x, y) = (1, 9)
while n > x * y:
	(n, x, y) = (n - x * y, x + 1, y * 10)
a = str(10 ** (x - 1) + n // x)[n % x]
print(a)


k = int(input(''))
y = 9
x = 1
i = 2
m = 0
if k < 10:
	print(k)
else:
	while k > y:
		h = y
		y = y + 9 * i * 10 ** x
		x += 1
		i += 1
	z = 10 ** (i - 1) + (k - y - 1) // (i - 1)
	q = (k - h - 1) % (i - 1)
	print(str(z)[q])


k = int(input())
total_digit = 0
digit = 1
while k > total_digit + digit * (pow(10, digit) - pow(10, digit - 1)):
	total_digit += digit * (pow(10, digit) - pow(10, digit - 1))
	digit += 1
remaining = k - total_digit - 1
corr_num = str(pow(10, digit - 1) + remaining // digit)
print(corr_num[remaining % digit])


import math
n = int(input())
k = 1
while n > 9 * k * 10 ** (k - 1):
	n = n - 9 * k * 10 ** (k - 1)
	k = k + 1
remainder = n % k
if remainder == 0:
	remainder = k
if k == 1:
	quoteint = math.ceil(n / k)
else:
	adder = '9' * (k - 1)
	adder = int(adder)
	quoteint = math.ceil(n / k) + adder
print(str(quoteint)[remainder - 1])


import sys
k = int(input())
d = [0]
for i in range(1, 12):
	d.append((10 ** i - 10 ** (i - 1)) * i + d[i - 1])
for i in range(1, len(d)):
	if k <= d[i]:
		f = d[i - 1]
		f1 = 10 ** (i - 1)
		print(str((k - f - 1) // i + f1)[(k - f - 1) % i])
		sys.exit()


import sys

class ADigitsSequenceEasyEdition:

	def solve(self):
		k = int(input()) + 1
		p = 1
		c = 0
		while c + p * (10 ** p - (10 ** (p - 1) if p > 1 else 0)) < k:
			c += p * (10 ** p - (10 ** (p - 1) if p > 1 else 0))
			p += 1
		k -= c
		bef = (10 ** (p - 1) if p > 1 else 0) + (k - 1) // p
		print(str(bef)[(k - 1) % p], end='')
solver = ADigitsSequenceEasyEdition()
input = sys.stdin.readline
solver.solve()


n = int(input())
sequence = 0
digit = 0
while True:
	digit += 1
	a = 10 ** (digit - 1)
	b = int('9' * digit)
	sequence = (b - a + 1) * digit
	if n < sequence:
		break
	else:
		n -= sequence
rem = n % digit
order = n // digit
if rem != 0:
	x = 1
else:
	x = 0
term = str(a + (order + x - 1))
print(term[rem - 1])


k = int(input(''))
a = [9]
i = 1
if k < 10:
	print(k)
else:
	while k > a[-1]:
		a.append((10 ** (i + 1) - 10 ** i) * (i + 1) + a[i - 1])
		i += 1
	cat = len(a)
	diff = k - a[-2]
	step = int(diff / cat)
	rem = diff % cat
	if rem == 0:
		number = 10 ** (cat - 1) - 1 + step
		print(str(number)[-1])
	else:
		number = 10 ** (cat - 1) + step
		print(str(number)[rem - 1])


N = int(input())
beg = 0
end = 9
i = 0
while N > end:
	i += 1
	(beg, end) = (end, end + (i + 1) * 9 * 10 ** i)
n = N - beg - 1
lvl = i - n % (i + 1)
period = (i + 1) * 10 ** lvl
res = n // period % 10
if lvl == i:
	res += 1
print(res)


n = int(input())
if n <= 9:
	print(n)
else:
	i = 0
	while (n - 9 * 10 ** i * (i + 1) > 0) & (i <= 11):
		n = n - 9 * 10 ** i * (i + 1)
		i = i + 1
	r = n % (i + 1)
	p = n // (i + 1)
	d = 10 ** i + p - 1
	if r != 0:
		d = d + 1
	ch = str(d)
	print(ch[r - 1])


n = int(input())
limit_int = limit = decimal = 9
count = 0
while True:
	count += 1
	if n <= limit:
		difference = limit - n
		position = difference % count
		difference = difference // count
		difference = decimal - difference
		print(''.join(list(reversed(str(difference))))[position])
		break
	else:
		decimal = int(str(limit_int) * (count + 1))
		limit += int(str(limit_int) + '0' * count) * (count + 1)


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def inp():
	return int(stdin.readline())

def pr(n):
	return stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp() - 1
	pre = 0
	cur = 1
	point = 1
	while pre + 9 * cur * point < n:
		pre += 9 * cur * point
		cur *= 10
		point += 1
	n -= pre
	(num, pos) = divmod(n, point)
	num += pow(10, point - 1)
	pr(str(num)[pos])
for _ in range(1):
	solve()


k = int(input())
num_digits = 1
num_numbers = 9
k -= 1
while k > num_digits * num_numbers:
	k -= num_numbers * num_digits
	num_digits += 1
	num_numbers *= 10
number = 10 ** (num_digits - 1) + k // num_digits
index = k % num_digits
answer = str(number)[index]
print(answer)


import math

def countDigit(n):
	return math.floor(math.log(n, 10) + 1)
n = int(input())
count = countDigit(n)
if count == 1:
	print(n)
else:
	low = 1
	high = 9
	sum = []
	digit = 0
	sum.append(0)
	sum.append(9)
	for i in range(2, 16):
		low = low * 10
		high = high * 10 + 9
		sum.append((high - low + 1) * i + sum[i - 1])
		if n < sum[i]:
			digit = i
			break
	x = n - sum[digit - 1]
	q = x / digit
	r = x % digit
	low = math.pow(10, digit - 1)
	low = low + q - 1
	if r == 0:
		print(int(low % 10))
	else:
		n = low + 1
		stringnum = str(n)
		print(int(stringnum[r - 1]))


k = int(input())
mul = 1
d = 1
while k > mul * 9 * d:
	k -= mul * 9 * d
	d += 1
	mul *= 10
x = k % d
y = k // d
y += mul
if x == 0:
	print((y - 1) % 10)
else:
	y = y // pow(10, d - x)
	print(y % 10)


from math import pow
n = int(int(input()) - 1)
x = 1
y = 9
while n > x * y:
	n -= x * y
	x += 1
	y *= 10
a = int(pow(10, x - 1)) + int(n / x)
z = str(a)
which = n % x
print(z[which])


n = int(input())
if n <= 9:
	print(n)
	exit(0)
a = 9
b = 1
while True:
	if n > b * a:
		n = n - b * a
		a *= 10
		b += 1
	else:
		break
dig = 10 ** (b - 1)
q = (n - 1) // b
r = (n - 1) % b
num = dig + q
print(str(num)[r])


N = int(input())
terms = 1
n = 9
total = 0
while N > terms * n:
	N = N - terms * n
	total = total + n
	terms = terms + 1
	n = n * 10
print(str(total + (N + terms - 1) // terms)[(N - 1) % terms])


def totaller(i):
	if i == 0:
		return 0
	else:
		total1 = totaller(i - 1) + 9 * 10 ** (i - 1) * i
		return total1
no_of_digits = int(input())
j = 0
for i in range(1, 13):
	if no_of_digits >= totaller(i):
		j = i
kth_digit = (no_of_digits - totaller(j)) // (j + 1)
if (no_of_digits - totaller(j)) % (j + 1) != 0:
	answer = str(kth_digit + 10 ** j)
	print(answer[(no_of_digits - totaller(j)) % (j + 1) - 1])
else:
	answer = str(kth_digit + 10 ** j - 1)
	print(answer[(no_of_digits - totaller(j)) % (j + 1) - 1])


def f(x):
	(dig, cnt) = (1, 9)
	ans = 0
	while dig != len(str(x)):
		ans += dig * cnt
		dig += 1
		cnt *= 10
	ans += (x - cnt // 9 + 1) * dig
	return ans
k = int(input())
(l, r) = (1, 1000000000000)
if k == 1:
	print(1)
	return
while l < r:
	mid = l + r + 1 >> 1
	if f(mid) < k:
		l = mid
	else:
		r = mid - 1
k -= f(l)
l += 1
print(str(l)[k - 1])


idx = {}
idx[0] = 0
s = 0
num = 9
for digit in range(1, 12):
	s += num * digit
	idx[digit] = s
	num = num * 10
N = int(input())
nubmer = 0
r = 0
d = 0
for digit in range(1, 12):
	if N <= idx[digit] and N > idx[digit - 1]:
		number = (N - idx[digit - 1]) // digit
		r = (N - idx[digit - 1]) % digit
		d = digit
		break
if r != 0:
	number += 1
num = 10 ** (d - 1) + number - 1
digit = [int(i) for i in str(num)]
if r == 0:
	print(digit[-1])
else:
	print(digit[r - 1])


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
from heapq import heapify, heappop, heappush, heapreplace, heappushpop
from bisect import bisect_right, bisect_left

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
mod = 1000000007
res = ['NO', 'YES']
aa = [9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, 9999999999]
a = [9, 189, 2889, 38889, 488889, 5888889, 68888889, 788888889, 8888888889, 98888888889, 1088888888889]
test = 1
test_case = 1
while test <= test_case:
	test += 1
	n = ii()
	if n in a:
		n = 9
	if n < 10:
		print(n)
		exit()
	x = 1
	while a[x] < n:
		x += 1
	v = n - a[x - 1]
	z = v // (x + 1)
	z += aa[x - 1]
	v %= x + 1
	if not v:
		p = z % 10
	else:
		z += 1
		p = int(str(z)[v - 1])
	print(p)


digit = 1
x = int(input())
start_range = 1
end_range = 9
nine = 9
total = 0
while x > end_range:
	start_range = end_range + 1
	digit += 1
	end_range += digit * nine * pow(10, digit - 1)
	total = total + start_range
start = pow(10, digit - 1)
number = int((x - start_range) / digit)
index = int((x - start_range) % digit)
start = start + number
string = str(start)
print(string[index])


k = int(input())
nc = [0 for i in range(14)]
for i in range(1, 14):
	nc[i] += nc[i - 1] + 9 * 10 ** (i - 1) * i
for i in range(13):
	if nc[i] < k <= nc[i + 1]:
		cif = i + 1
if cif == 1:
	print(k)
	quit()
c = k - nc[cif - 1]
if c % cif == 0:
	nnr = c // cif
	ncif = cif
else:
	nnr = 1 + c // cif
	ncif = c % cif
number = nnr + 10 ** (cif - 1) - 1
while cif != ncif:
	number //= 10
	cif -= 1
print(number % 10)


(a, b, c, d, e, f, g, h, i, j, k, l) = [9 * 1, 90 * 2, 900 * 3, 9000 * 4, 90000 * 5, 900000 * 6, 9000000 * 7, 90000000 * 8, 900000000 * 9, 9000000000 * 10, 90000000000 * 11, 900000000000 * 12]
a = a
b = a + b
c = b + c
d = c + d
e = d + e
f = e + f
g = f + g
h = g + h
i = h + i
j = i + j
k = j + k
l = k + l
li1 = [0, a, b, c, d, e, f, g, h, i, j, k, l]
n = int(input())
nn = 0
for ii in range(1, 12):
	if li1[ii - 1] < n and li1[ii + 1] > n:
		nn = ii
n = n - li1[nn - 1]
r1 = 10 ** (nn - 1)
n1 = n // nn
r1 += n1 - 1
n2 = n - n1 * nn
if n2 == 0:
	print(str(r1)[-1])
else:
	print(str(r1 + 1)[n2 - 1])


n = int(input())
i = 1
s = 0
while i * 9 * 10 ** (i - 1) < n - s:
	s += i * 10 ** (i - 1) * 9
	i += 1
n -= s
j = n // i
k = n % i
if k is 0:
	ind = i - 1
else:
	ind = k - 1
print(str(10 ** (i - 1) + j - 1 + (k > 0))[ind])


def n_to_array(number):
	str_number = str(number)
	arr_number = []
	for digit in str_number:
		arr_number.append(int(digit))
	return arr_number

def n_digits(number):
	if number == 0:
		return 1
	n = 0
	while number > 0:
		n += 1
		number = number // 10
	return n

def _1177A(k):
	if k < 10:
		print(k)
		return
	k -= 9
	a = 10
	b = 99
	while (b - a + 1) * n_digits(a) < k:
		k -= (b - a + 1) * n_digits(a)
		a *= 10
		b *= 10
		b += 9
	nr = a + (k + n_digits(a) - 1) // n_digits(a) - 1
	ord = (k - 1) % n_digits(a)
	print(n_to_array(nr)[ord])
_1177A(int(input()))


from math import floor
from sys import stdin
CONST = 9

def solve(k):
	i = 0
	while k > CONST * 10 ** i * (i + 1):
		k -= floor(CONST * 10 ** i) * (i + 1)
		i += 1
	num_digits = i + 1
	num = floor((k - 1) / num_digits)
	num += floor(10 ** i)
	print('{}'.format(num)[(k - 1) % num_digits])
for line in stdin:
	solve(int(line.rstrip()))


k = int(input())
count = 1
number = 1
result = 0
number1 = 1
while True:
	if number == 1:
		if result + 9 < k:
			result += 9
			number = 20
			number1 = 10
		else:
			break
	elif number == 20:
		if result + 180 < k:
			result += 180
			number += 10
			number1 = 100
		else:
			break
	elif result + 9 * number * 10 ** count < k:
		result += 9 * number * 10 ** count
		number += 10
		count += 1
		number1 *= 10
	else:
		break
while True:
	if count == 0:
		break
	if result + number * 10 ** count < k:
		result += number * 10 ** count
		number1 += 100 * 10 ** (count - 1)
	else:
		count -= 1
while True:
	if number == 1:
		break
	if result + number < k:
		result += number
		number1 += 10
	else:
		break
while True:
	if result + len(str(number1)) >= k:
		print(str(number1)[k - result - 1])
		break
	else:
		number1 += 1
		result += len(str(number1))


k = int(input()) - 1
w = 1
p = 9
while k >= w * p:
	k -= w * p
	w += 1
	p *= 10
x = p // 9 + k // w
print(str(x)[k % w])


import sys, math, queue, bisect
MOD = 998244353
sys.setrecursionlimit(1000000)
n = int(input())
if n < 10:
	print(n)
	exit()
d = 1
while n > 9 * d * pow(10, d - 1):
	n -= 9 * d * pow(10, d - 1)
	d += 1
x = pow(10, d - 1) + (n - 1) // d
p = n % d
x = str(x).zfill(d)
print(x[p - 1])


k = int(input())
s = 0
i = 1
while s + i * (9 * pow(10, i - 1)) < k:
	s += i * (9 * pow(10, i - 1))
	i += 1
else:
	i -= 1
k = k - s - 1
x = k // (i + 1)
y = k % (i + 1)
x = pow(10, i) + x
ss = str(x)
print(ss[y])


A = [9, 189, 2889, 38889, 488889, 5888889, 68888889, 788888889, 8888888889, 98888888889, 1088888888889]
k = int(input())
if k < 10:
	print(k)
else:
	for n in range(0, 12):
		if k > A[n + 1]:
			continue
		else:
			a = 10 ** (n + 1) + (k - A[n] - 1) // (n + 2)
			b = (k - A[n] - 1) % (n + 2)
			print(str(a)[b])
			break


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
n = get_int()
end = 0
digit = 0
while True:
	digit += 1
	a = 10 ** (digit - 1)
	b = int('9' * digit)
	start = end + 1
	end = end + (b - a + 1) * digit
	if n <= end:
		break
rem = (n - start + 1) % digit
seq = (n - start + 1) // digit
if rem != 0:
	x = 1
else:
	x = 0
term = str(a + (seq + x - 1))
print(term[rem - 1])


l = []
n = []
sum = 0
multiply = 9
for i in range(1, 12):
	s = '9' * i
	n.append(int(s))
	sum += i * multiply
	multiply *= 10
	l.append(sum)
k = int(input())
if k < 9:
	print(k)
else:
	t = 0
	for i in range(len(l)):
		if k < l[i]:
			t = i
			break
	temp = k - l[t - 1]
	offset = temp % (t + 1)
	value = temp // (t + 1)
	number = n[t - 1] + value
	if offset == 0:
		print(number % 10)
	else:
		number += 1
		offset -= 1
		print(str(number)[offset])


a = int(input())
i = 1
amount = a
while amount > i * (10 ** i - 10 ** (i - 1)):
	amount = amount - i * (10 ** i - 10 ** (i - 1))
	i = i + 1
x = amount // i
y = amount % i
if y == 0:
	if i == 1:
		print(x % 10)
	else:
		print((10 ** (i - 1) + x - 1) % 10)
elif i == 1:
	print(x % 10)
else:
	print((10 ** (i - 1) + x) // 10 ** (i - y) % 10)


k = int(input(''))
sol = ''
cnt = 0
for i in range(1, 13):
	inc = 9 * 10 ** (i - 1) * i
	if cnt + inc >= k:
		break
	else:
		cnt += inc
lft = k - cnt
dig = lft / i
if dig != int(dig):
	dig = int(dig + 1)
else:
	dig = int(dig)
num = 10 ** (i - 1) + dig - 1
left = k - (cnt + dig * i)
sol = str(num)
print(sol[left - 1])


k = input()
k = int(k)
n = 1
while k - n * 9 * 10 ** (n - 1) > 0:
	k = k - n * 9 * 10 ** (n - 1)
	n = n + 1
n = n - 1
if n == 0:
	print(k)
else:
	nth_num = (k - 1) // (n + 1) + 1
	num = 10 ** n + nth_num - 1
	pos = (k - 1) % (n + 1)
	print(int(str(num)[pos]))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_left as bsl

def main():
	cur = 9
	count = 1
	tot = 0
	num = []
	cc = []
	for s in range(11):
		num.append(cur * count)
		tot += cur
		cc.append(tot)
		cur *= 10
		count += 1
	ans = [num[0]]
	for s in range(1, 11):
		ans.append(ans[-1] + num[s])
	k = int(input())
	ind = min(bsl(ans, k), 10)
	left = k
	if ind > 0:
		left -= ans[ind - 1]
	nums = left // (ind + 1)
	rem = left % (ind + 1)
	if left % (ind + 1) != 0:
		nums += 1
	if ind > 0:
		nums += cc[ind - 1]
	answer = [int(k) for k in str(nums)]
	print(answer[rem - 1])
main()


k = int(input())
if k <= 9:
	print(k)
else:
	s = 9
	n = 1
	while s < k:
		n += 1
		prev_s = s
		s += (10 ** n - 10 ** (n - 1)) * n
	digit_pos = k - (prev_s + 1)
	number = 10 ** (n - 1) + digit_pos // n
	if digit_pos / n != digit_pos // n:
		digit_pos = digit_pos - digit_pos // n * n
	else:
		digit_pos = 0
	print(str(number)[digit_pos])


k = int(input())
prev = 0
nextt = 0
NumofDigits = 0
while True:
	prev = nextt
	nextt = nextt + 9 * 10 ** (NumofDigits - 1) * NumofDigits
	if k >= prev and k <= nextt:
		break
	NumofDigits = NumofDigits + 1
if NumofDigits == 1:
	print(k)
else:
	result = 10 ** (NumofDigits - 1) + int((k - (prev + 1)) / NumofDigits)
	i = 0
	while True:
		if (k - int(prev + 1)) % NumofDigits == i:
			break
		i = i + 1
	result = str(result)
	print(result[i])


k = int(input())
if k < 10:
	print(k)
	quit()
c = 0
n = k
a = k
while n > 0:
	c += 1
	sub = 10 ** c - 10 ** (c - 1)
	a -= sub * c
	n = a / (c + 1) + (10 ** c - 1)
	if n + 1 <= 10 ** (c + 1):
		if int(n) == n:
			print(int(n % 10))
			exit()
		else:
			print(str(int(n) + 1)[round((n - int(n)) * (c + 1)) - 1])
			exit()


import sys
n = int(input())
ind = 0
dig = 0
for i in range(1, 12):
	dig += i * 10 ** (i - 1) * 9
	if dig > n:
		ind = i - 1
		rt = dig - i * 10 ** (i - 1) * 9
		break
n -= rt
no = 10 ** ind
if n == 0:
	print(9)
	sys.exit()
u = n
n -= n // (ind + 1) * (ind + 1)
no += max(0, u // (ind + 1) - 1)
if n == 0:
	print(str(no)[-1])
else:
	no += 1
while n > 0:
	if n <= ind + 1:
		e = str(no)
		print(e[n - 1])
	n -= ind + 1
	no += 1


from math import log
k = int(input())
r = k
l = 1
t = log(10)
while 1:
	m = (l + r) // 2
	x = int(log(m) / t)
	d = (1 - 10 ** (x + 1)) // 9 + (m + 1) * (x + 1)
	if 0 <= k - d <= 13:
		break
	elif d > k:
		r = m - 1
	else:
		l = m + 1
if m == 1000:
	d += 1
if d == k:
	print(str(m)[-1])
	exit()
st = ''
v = k - d
m += 1
for i in range(13):
	st += str(m)
	m += 1
print(st[v - 1])


digit = int(input())
if int(digit) <= 9:
	print(digit)
	exit()
start_range = 1
end_range = 9
power = 1
digit_count = 2
while not (start_range <= digit and digit <= end_range):
	start_range = end_range + 1
	end_range = 9 * 10 ** power * digit_count + start_range - 1
	power += 1
	digit_count += 1
offset_number = (digit - start_range) // (digit_count - 1)
number = str(10 ** (power - 1) + offset_number)
offset_digit = (digit - start_range) % (digit_count - 1)
print(f'{number[offset_digit]}')


s = 0
t = 0
c = 0
k = int(input())
while s < k:
	te = s
	temp = t
	t = t + 9 * pow(10, c)
	s = s + 9 * pow(10, c) * (c + 1)
	c = c + 1
a = (k - te) // c
re = (k - te) % c
if re == 0:
	a = a + temp
	a = str(a)
	print(a[-1])
else:
	a = a + temp + 1
	a = str(a)
	print(a[re - 1])


n = int(input())

def exp_(i):
	return (9 * pow(10, i) * i - 10 ** i + 1) // 9
i = 0
while True:
	v = exp_(i)
	if v >= n:
		break
	i = i + 1
if n == v:
	print('9')
else:
	n = n - exp_(i - 1)
	num = 10 ** (i - 1) - 1
	num = num + n // i
	r = n % i
	if r > 0:
		num = num + 1
		f = str(num)
		print(f[r - 1])
	else:
		t = str(num)
		print(t[-1])


import math
k = int(input())
s = 0
i = 0
while s < k:
	s = s + 9 * 10 ** i * (i + 1)
	i = i + 1
if k < 10:
	print(k)
else:
	k = k - s + 9 * 10 ** (i - 1) * i
	a = int(math.floor((k - 1) / i))
	a = a + 10 ** (i - 1)
	l = list(str(a))
	r = int((k - 1) % i)
	a = int(l[r])
	print(a)


T = (0, 9, 189, 2889, 38889, 488889, 5888889, 68888889, 788888889, 8888888889, 98888888889, 1088888888889)
k = int(input())
a = 0
for i in T:
	if i - k > 0:
		a = T.index(i)
		break
temp = T[a] - k
x = temp % a
res = 10 ** a - 1 - int(temp / a)
ans = int(res % 10 ** (x + 1) / 10 ** x)
print(ans)


k = int(input())
for i in range(20):
	if k > 10 ** i * 9 * (i + 1):
		k -= 10 ** i * 9 * (i + 1)
	else:
		(a, b) = ((k - 1) // (i + 1) + 10 ** i, (k - 1) % (i + 1))
		print(str(a)[b])
		break


k = int(input())
ch = 0
i = 0
r = 1
while k > r - 1:
	r += 9 * (i + 1) * 10 ** i
	i += 1
r -= 9 * i * 10 ** (i - 1)
print(str((k - r) // i + 10 ** (i - 1))[(k - r) % i])


L = [(i + 1) * 9 * 10 ** i for i in range(12)]
number = int(input())
exponent = 0
while number >= 0:
	number -= L[exponent]
	exponent += 1
exponent -= 1
number %= L[exponent]
start = 10 ** exponent
numDigits = exponent + 1
final = start + (number // numDigits - 1)
remainder = number % numDigits
if remainder == 0:
	final = str(final)
	print(final[-1])
else:
	final = str(final + 1)
	print(final[remainder - 1])


k = int(input())
if k <= 9:
	print(k)
else:
	length = len(str(k))
	s = ''
	num = 0
	for i in range(length - 1):
		num += 9 * 10 ** i * (i + 1)
		temp = num + 9 * 10 ** (i + 1) * (i + 2)
		if temp > k:
			length = i + 2
			break
	for i in range(length - 1):
		s = s + '1'
	previous_value = 9 * int(s)
	try_value = k - num
	if try_value % length == 0:
		div_value = try_value // length
		temp_string = str(previous_value + div_value)
		print(temp_string[len(temp_string) - 1])
	else:
		div_value = try_value // length + 1
		temp_string = str(previous_value + div_value)
		differ = div_value * length - try_value
		print(temp_string[len(temp_string) - differ - 1])


import bisect
xyz = [9, 90, 900, 9000, 90000, 900000, 9000000, 90000000, 900000000, 9000000000, 900000000000]
xzy = [10, 190, 2890, 38890, 488890, 5888890, 68888890, 788888890, 8888888890, 98888888890, 1088888888890, 11888888888890]
count = 2
k = int(input())
digits = bisect.bisect_left(xzy, k)
if k == 10:
	print(1)
elif k > 10:
	apu = k - xzy[digits - 1]
	modulo = apu % (digits + 1)
	dlj = apu // (digits + 1)
	output = 10 ** digits + dlj
	list1 = [i for i in str(output)]
	print(list1[modulo])
else:
	print(k)


import math
n = int(input())
a = [9]
for i in range(2, 20):
	a.append(10 ** i - 10 ** (i - 1))
b = [0]
for i in range(1, 20):
	b.append(b[-1] + i * a[i - 1])
for i in range(20):
	if n <= b[i]:
		break
p = b[i - 1]
k = n - p
ans = 10 ** (i - 1) - 1 + math.ceil(k / i)
if k % i == 0:
	print(('0' + str(ans))[i])
else:
	print(('0' + str(ans))[k % i])


from math import ceil
n = int(input())
if n <= 9:
	print(n)
else:
	d = 2
	ov = 9
	while n > d * 9 * 10 ** (d - 1) + ov:
		ov = d * 9 * 10 ** (d - 1) + ov
		d += 1
	v = ceil((n - ov) / d) + int('9' * (d - 1))
	print(str(v)[(n - ov - 1) % d])


k = int(input())
k -= 1
(pow_10, length) = (1, 1)
while 9 * pow_10 * length < k:
	k -= 9 * pow_10 * length
	pow_10 *= 10
	length += 1
div = k / length
rem = k % length
num = pow_10 + div
print(str(num)[rem])


pre_cal_sum_dec = {}

def sum_dec(n):
	global pre_cal_sum_dec
	try:
		return pre_cal_sum_dec[n]
	except:
		sumer = 0
		for i in range(1, n):
			sumer += 10 ** i
		pre_cal_sum_dec[n] = sumer
		return sumer

def find_head(digits):
	if digits < 1:
		return 0
	elif digits == 1:
		return 1
	else:
		return (digits - 1) * 10 ** (digits - 1) - sum_dec(digits - 1)

def cutter(start, end):
	listo = [0 for _ in range(10)]
	part = (end - start) // 9
	listo[0] = start
	for each in range(1, 10):
		start += part
		listo[each] = start
	return listo

def finder(number):
	(x, i) = (0, 0)
	if number == 1:
		return 1
	while x < number:
		bef = x
		x = find_head(i)
		i += 1
	if x == number:
		return 1
	e = i - 2
	number = number - bef
	interval = e * 10 ** (e - 1)
	col = number % e
	if col == 0:
		return (number // interval + 1) % 10
	return number // (e * 10 ** (e - 1 - col)) % 10
print(finder(int(input())))


n = int(input())
s = 0
pred = 0
for i in range(1, 20):
	m = 9 * pow(10, i - 1) * i
	s += m
	if n <= s:
		nd = pow(10, i - 1)
		sme = n - pred
		num = sme // i
		ost = sme % i
		if ost == 0:
			dig = nd + num - 1
		else:
			dig = nd + num
		d = i
		rez = []
		ddig = dig
		while d > 0:
			o = ddig % 10
			a = ddig // 10
			rez.append(o)
			d -= 1
			ddig = a
		break
	pred = s
print(str(rez[-ost]))


k = int(input())
x = [0, 9]
i = 2
y = 90
while x[-1] < 10 ** 12:
	x.append(x[-1] + y * i)
	y *= 10
	i += 1
if k in x:
	print(9)
else:
	for t in range(len(x)):
		if k < x[t]:
			break
	e = k - x[t - 1]
	if t == 1:
		q = str(e)
	else:
		q = str(10 ** (t - 1) + e // t - 1)
	if e % t == 0:
		print(q[-1])
	else:
		q = str(int(q) + 1)
		print(q[e % t - 1])


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def read_string():
	return sys.stdin.readline().strip()

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)
k = read_int()
base_digit_number = 1
expo = 0
while k >= base_digit_number:
	base_digit_number += 9 * (expo + 1) * 10 ** expo
	expo += 1
base_digit_number -= 9 * expo * 10 ** (expo - 1)
ans_number = (k - base_digit_number) // expo + 10 ** (expo - 1)
ans_digit = str(ans_number)[(k - base_digit_number) % expo]
print(ans_digit)


def main():
	k = int(input())
	digit = 1
	low = 1
	high = 9
	totalDigit = 9
	lastTotalDigit = 0
	while totalDigit < k:
		low *= 10
		high = 10 * low - 1
		digit += 1
		lastTotalDigit = totalDigit
		totalDigit += (high + 1 - low) * digit
	k -= lastTotalDigit
	cur = str(low + (k - 1) // digit)
	print(cur[(k - 1) % digit])
main()


def get_kth_digit(i):
	if i < 10:
		return i
	batch = 9
	count = 9
	width = 1
	while i > 10 * batch * (width + 1) + count:
		batch *= 10
		width += 1
		count += batch * width
	k = i - count - 1
	num = 10 ** width + k // (width + 1)
	return str(num)[k % (width + 1)]

def main():
	i = int(input())
	print(get_kth_digit(i))
main()


import bisect
b = []
a = []
b.append(0)
for i in range(1, 15):
	b.append(9 * i * 10 ** (i - 1))
a.append(b[0])
for i in range(1, 15):
	a.append(a[i - 1] + b[i])
k = int(input())
th = bisect.bisect_left(a, k)
th -= 1
k = k - a[th]
start = 10 ** th
now = th + 1
rem = k % now
iss = k / now
end = start + k / now
temp = str(end - 1)
s = ''
s += temp[now - 1] + str(end) + str(end + 1)
print(s[0 + rem])


import math

def get_digit(x, pos):
	s = []
	while x > 0:
		s.append(x % 10)
		x //= 10
	return s[::-1][pos]

def find_digit(x):
	n = 0
	next_ = 9 * 10 ** n * (n + 1)
	while next_ <= x:
		x -= next_
		n += 1
		next_ = 9 * 10 ** n * (n + 1)
	if x == 0:
		return 9
	pos_ = 10 ** n + math.ceil(x / (n + 1)) - 1
	return get_digit(pos_, (x - 1) % (n + 1))
k = int(input())
print(find_digit(k))


k = int(input(''))
t = 0
if k == 0:
	print('Invalid input')
	exit()
while k > 0:
	if k <= 9 * 10 ** t * (t + 1):
		m = k // (t + 1)
		l = k
	k = k - 9 * 10 ** t * (t + 1)
	t += 1
p = l % t
if p == 0:
	n = 10 ** (t - 1) + m - 1
	o = n % 10
else:
	n = 10 ** (t - 1) + m
	o = n // 10 ** (t - p) % 10
print(o)


k = int(input())
x = 0
c = 0
while x < k:
	x += 9 * 10 ** c * (c + 1)
	c += 1
p = (x - k) % c
k = 10 ** c - int((x - k) / c) - 1
k = str(k)
print(k[len(k) - p - 1])


from sys import stdin

def solve(tc):
	k = int(stdin.readline().strip())
	cmp = 9
	ndigit = 1
	while k > cmp * ndigit:
		k -= cmp * ndigit
		cmp *= 10
		ndigit += 1
	num = 10 ** (ndigit - 1) + (k - 1) // ndigit
	pos = (k - 1) % ndigit
	print(str(num)[pos])
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


n = int(input())
strt = 1
n -= 1
cnt = 9
while n > strt * cnt:
	n -= cnt * strt
	cnt *= 10
	strt += 1
ans = 10 ** (strt - 1)
ans += n // strt
print(str(ans)[n % strt])


index = int(input())
total = 9
n = 1
while index > total:
	total += (n + 1) * 10 ** n * 9
	n += 1
last = 10 ** (n - 1)
total -= n * 9 * last
index = index - total
r = index % n
k = index // n
number = last + k
if r == 0:
	print(str(number - 1)[n - 1])
else:
	print(str(number)[r - 1])


k = int(input())
if k <= 9:
	print(k)
else:
	length = len(str(k))
	places_occupied = 0
	for i in range(length - 1):
		places_occupied += 9 * 10 ** i * (i + 1)
		temp = places_occupied + 9 * 10 ** (i + 1) * (i + 2)
		if temp > k:
			length = i + 2
			break
	digits_string = ''
	for i in range(length - 1):
		digits_string = digits_string + '1'
	numbers_passed = 9 * int(digits_string)
	places_left = k - places_occupied
	if places_left % length == 0:
		numbers_required = places_left // length
		answer_string = str(numbers_passed + numbers_required)
		print(answer_string[len(answer_string) - 1])
	else:
		numbers_required = places_left // length + 1
		answer_string = str(numbers_passed + numbers_required)
		find_index = numbers_required * length - places_left
		print(answer_string[len(answer_string) - find_index - 1])


k = int(input())
n = 0
i = 0
while k > n:
	n += pow(10, i) * 9 * (i + 1)
	i = i + 1
n -= pow(10, i - 1) * 9 * i
k -= n
t = (k - 1) / i
r = k % i
if r == 0:
	r = i
m = pow(10, i - 1) + t
m = int(m)
ans = int(m / pow(10, i - r)) % 10
print(ans)

def pow(i):
	n = 1
	for x in range(0, i):
		n *= 10
	return n


import bisect
xzy = [10, 190, 2890, 38890, 488890, 5888890, 68888890, 788888890, 8888888890, 98888888890, 1088888888890, 11888888888890]
k = int(input())
digits = bisect.bisect_left(xzy, k)
if k == 10:
	print(1)
elif k > 10:
	apu = k - xzy[digits - 1]
	modulo = apu % (digits + 1)
	dlj = apu // (digits + 1)
	output = 10 ** digits + dlj
	list1 = [i for i in str(output)]
	print(list1[modulo])
else:
	print(k)


n = int(input())
c = 1
total = 0
if n < 10:
	print(n)
else:
	while True:
		total_b = total
		cek = 9 * 10 ** (c - 1) * c
		total += cek
		if n <= total:
			break
		c += 1
	n -= total_b + 1
	urut = n // c
	sisa = n % c
	angka = 10 ** (c - 1) + urut
	print(str(angka)[sisa])


k = int(input())
a = []
for i in range(0, 12):
	s = 9 * pow(10, i) * (i + 1)
	if k <= s:
		break
	else:
		k -= s
pos = i + 1
num = pow(10, pos - 1) + k // pos - 1
if k % pos == 0:
	print(str(num)[-1])
else:
	print(str(num + (0 if pos == 1 else 1))[k % pos - 1])


import math
k = int(input())

def cnt_digit_order(X):
	res = 0
	if X == 0:
		return 0
	for i in range(1, X + 1):
		res += i * (9 * pow(10, i - 1))
	return res
L = -1
leftcnt = 0
for length in range(1, 100):
	if cnt_digit_order(length - 1) < k <= cnt_digit_order(length):
		L = length
		leftcnt = k - cnt_digit_order(length - 1)
		break
M = str(math.ceil(leftcnt / L) + (10 ** (L - 1) - 1))
leftcnt -= 1
leftcnt %= L
print(M[leftcnt])


k = int(input())
k -= 1
c = 9
s = 1
while k >= c * s:
	k -= c * s
	c *= 10
	s += 1
n = 10 ** (s - 1) + k // s
idx = k % s
print(str(n)[idx])


n = int(input())
x = 1
while n > 10 ** (len(str(x)) - 1) * 9 * len(str(x)):
	n -= 10 ** (len(str(x)) - 1) * 9 * len(str(x))
	x *= 10
t = len(str(x))
nadighe = False
while nadighe == False:
	qw = 1
	nadighe = True
	while n > 10 ** (len(str(qw)) - 1) * 9 * t:
		n -= 10 ** (len(str(qw)) - 1) * 9 * t
		nadighe = False
		qw *= 10
	x += qw - 1
while n > len(str(x)):
	n -= len(str(x))
	x += 1
for i in range(len(str(x))):
	if n != 0:
		s = str(x)[i]
		n -= 1
print(s)


n = int(input())
start = 1
end = 9
nr = 1
ran = 9
l = 1
while 1:
	if n > ran:
		nr = ran
		start = start * 10
		end = end * 10 + 9
		l += 1
		ran = ran + (end - start + 1) * l
	else:
		r = n - nr - 1 * (n > 9)
		print(str(end // 10 + r // l + 1)[r % l])
		break


k = int(input())
s = k
i = 1
number_digits = 1
while s - i * (9 * 10 ** (i - 1)) > 0:
	number_digits = number_digits + 1
	s = s - i * (9 * 10 ** (i - 1))
	i += 1
v = (s - 1) // number_digits
s = s - v * number_digits
ans = 10 ** (number_digits - 1) + v
ans = str(ans)
fans = ans[s - 1]
print(fans)


def mp():
	return map(int, input().split())

def f(i):
	return (10 ** i - 10 ** (i - 1)) * i
n = int(input())
i = 1
sum = 0
while n - f(i) >= 0:
	n -= f(i)
	sum += f(i) // i
	i += 1
print(str(sum + (n + i - 1) // i)[n % i - 1])


n = int(input()) - 1
c = 0
for i in range(11):
	c += 9 * (i + 1) * 10 ** i
	if c > n:
		n -= c - 9 * (i + 1) * 10 ** i
		v = n // (i + 1)
		print(str(10 ** i + v)[n % (i + 1)])
		break


k = int(input())
k_ = k
ca = 9
di = 1
tem = 9
while k_ > 0:
	k_ -= ca * di
	ca *= 10
	di += 1
	tem += ca * di
	if k_ == 0:
		break
tem -= ca * di
ca = int(ca / 10)
di -= 1
tem -= ca * di
ca = int(ca / 10)
ca_ = 0
while ca > 0:
	ca_ += ca
	ca = int(ca / 10)
k -= tem
re = int((k + di - 1) // di) + ca_
re_ = k % di
if re_ == 0:
	l = 1
else:
	l = 10 ** (di - re_)
re = int(re // l)
print(re % 10)


k = int(input())
a = 9
for i in range(1, 12):
	if k <= a * i:
		a = a // 9 + k // i - 1
		if k % i != 0:
			b = str(a + 1)
			c = k % i - 1
			print(b[c])
		else:
			b = str(a)
			print(b[-1])
		break
	else:
		k = k - a * i
		a = a * 10


k = int(input())
n = 1
for i in range(1, 20):
	if k < n + 9 * 10 ** (i - 1) * i:
		print(str(10 ** (i - 1) + (k - n) // i)[(k - n) % i])
		break
	n += 9 * 10 ** (i - 1) * i


import sys

def input():
	return sys.stdin.readline().rstrip()

def slv():
	k = int(input())

	def cnt_special(N):
		if N == 0:
			return 0
		return cnt_special(N - 1) + N * (pow(10, N) - pow(10, N - 1))

	def cnt_digit(N):
		ord = len(str(N))
		bound = ord - 1
		return cnt_special(bound) + ord * (N + 1 - 10 ** bound)
	if k < 10:
		print(k)
	else:
		l = 1
		r = int(1000000000000.0)
		while r - l > 1:
			med = (r + l) // 2
			if cnt_digit(med) >= k:
				r = med
			else:
				l = med
		rep = k - cnt_digit(l)
		print(str(r)[rep - 1])
		return

def main():
	t = 1
	for i in range(t):
		slv()
	return
main()