Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... 

Note:
n is positive and will fit within the range of a 32-bit signed integer (n < 231).


Example 1:

Input:
3

Output:
3



Example 2:

Input:
11

Output:
0

Explanation:
The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... is a 0, which is part of the number 10.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'class Solution:\n     def findNthDigit(self, n):\n         """\n         :type n: int\n         :rtype: int\n         """\n         \n    #    my fourth solution.........\n         if n <= 0:\n             return\n         \n         i = 0\n         nbase = 0\n         thres = 1*9\n         if n <= thres:\n             return n\n         \n         while 1:\n             i += 1\n             nbase += 9*10**(i-1)\n             thres += (i+1)*9*10**i\n             if n <= thres:\n                 return int(str((n+i-(thres-(i+1)*9*10**i))//(i+1) + nbase)[(n+i-(thres-(i+1)*9*10**i))%(i+1)])\n                            \n                            \n                            \n                            \n         """\n    #    my third solution....beat 93%....\n         if n <= 0:\n             return\n         \n         nbase = 0\n         thres = 1*9\n         if n <= thres:\n             return n\n         \n         nbase += 9*10**0\n         thres += 2*9*10**1\n         if n <= thres:\n             return int(str((n+1-(thres-2*9*10**1))//2 + nbase)[(n+1-(thres-2*9*10**1))%2])\n         \n         nbase += 9*10**1\n         thres += 3*9*10**2\n         if n <= thres:\n             return int(str((n+2-(thres-3*9*10**2))//3 + nbase)[(n+2-(thres-3*9*10**2))%3])\n         \n         nbase += 9*10**2\n         thres += 4*9*10**3\n         if n <= thres:\n             return int(str((n+3-(thres-4*9*10**3))//4 + nbase)[(n+3-(thres-4*9*10**3))%4])\n         \n         nbase += 9*10**3\n         thres += 5*9*10**4\n         if n <= thres:\n             return int(str((n+4-(thres-5*9*10**4))//5 + nbase)[(n+4-(thres-5*9*10**4))%5])\n         \n         nbase += 9*10**4\n         thres += 6*9*10**5\n         if n <= thres:\n             return int(str((n+5-(thres-6*9*10**5))//6 + nbase)[(n+5-(thres-6*9*10**5))%6])\n         \n         nbase += 9*10**5\n         thres += 7*9*10**6\n         if n <= thres:\n             return int(str((n+6-(thres-7*9*10**6))//7 + nbase)[(n+6-(thres-7*9*10**6))%7])\n         \n         nbase += 9*10**6\n         thres += 8*9*10**7\n         if n <= thres:\n             return int(str((n+7-(thres-8*9*10**7))//8 + nbase)[(n+7-(thres-8*9*10**7))%8])\n         \n         nbase += 9*10**7\n         thres += 9*9*10**8\n         if n <= thres:\n             return int(str((n+8-(thres-9*9*10**8))//9 + nbase)[(n+8-(thres-9*9*10**8))%9])\n         """\n                            \n                            \n         \n         \n         """\n    #    my second solution........beat 96%....\n         if n <= 0:\n             return\n         \n         if n <= 1*9:\n             return n\n         \n         if n <= 1*9+2*90:\n             return int(str((n+1 - 1*9)//2 + 9)[(n+1 - 1*9)%2])\n         \n         if n <= 1*9+2*90+3*900:\n             return int(str((n+2 - 1*9-2*90)//3 + 99)[(n+2 - 1*9-2*90)%3])\n         \n         if n <= 1*9+2*90+3*900+4*9000:\n             return int(str((n+3 - 1*9-2*90-3*900)//4 + 999)[(n+3 - 1*9-2*90-3*900)%4])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000:\n             return int(str((n+4 - 1*9-2*90-3*900-4*9000)//5 + 9999)[(n+4 - 1*9-2*90-3*900-4*9000)%5])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000:\n             return int(str((n+5 - 1*9-2*90-3*900-4*9000-5*90000)//6 + 99999)[(n+5 - 1*9-2*90-3*900-4*9000-5*90000)%6])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000:\n             return int(str((n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)//7 + 999999)[(n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)%7])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000:\n             return int(str((n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)//8 + 9999999)[(n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)%8])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000+9*900000000:\n             return int(str((n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)//9 + 99999999)[(n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)%9])\n         """\n         \n         \n \n         \n         \n         \n         """\n    #    my first solution...........beat 93%.....\n         if n <= 0:\n             return\n         \n         if n <= 1*9:\n             return n\n         \n         if n <= 1*9+2*90:\n             return int(str((n+1 - 1*9)//2 + 9)[n%2])\n         \n         if n <= 1*9+2*90+3*900:\n             return int(str((n+2 - 1*9-2*90)//3 + 99)[n%3-1])\n         \n         if n <= 1*9+2*90+3*900+4*9000:\n             return int(str((n+3 - 1*9-2*90-3*900)//4 + 999)[n%4-2])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000:\n             return int(str((n+4 - 1*9-2*90-3*900-4*9000)//5 + 9999)[n%5])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000:\n             return int(str((n+5 - 1*9-2*90-3*900-4*9000-5*90000)//6 + 99999)[n%6-4])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000:\n             return int(str((n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)//7 + 999999)[n%7])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000:\n             return int(str((n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)//8 + 9999999)[n%8-2])\n         \n         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000+9*900000000:\n             return int(str((n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)//9 + 99999999)[n%9-1])\n         """\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'findNthDigit'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 5576