Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. Digits Sequence (Hard Edition)

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLet'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 10^{12}$$$) — 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

Codeforces (c) Copyright 2010-2022 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/26/2022 22:07:40 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|