#include <bits/stdc++.h>   #pragma GCC target( avx2 )   #pragma GCC optimization( O3 )   #pragma GCC optimization( unrolled-loops )   using namespace std;   const long long mod = 1e9 + 7;   int test = 1;   const int N = 100100;   long long n;   int k = 1;   long long x = 1;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     if (n > 9) {       n -= 9;       k++;       x *= 10;     }     if (n > 180) {       n -= 180;       k++;       x *= 10;     }     if (n > 2700) {       n -= 2700;       k++;       x *= 10;     }     if (n > 36000) {       n -= 36000;       k++;       x *= 10;     }     if (n > 450000) {       n -= 450000;       k++;       x *= 10;     }     if (n > 5400000) {       n -= 5400000;       k++;       x *= 10;     }     if (n > 63000000) {       n -= 63000000;       k++;       x *= 10;     }     if (n > 720000000) {       n -= 720000000;       k++;       x *= 10;     }     if (n > 8100000000) {       n -= 8100000000;       k++;       x *= 10;     }     if (n > 90000000000) {       n -= 90000000000;       k++;       x *= 10;     }     if (n > 990000000000) {       n -= 990000000000;       k++;       x *= 10;     }     long long m, l;     m = n / k;     l = n % k;     x += m - 1;     if (l == 0)       cout << x % 10;     else {       x++;       while (k > l) {         k--;         x /= 10;       }       cout << x % 10;     }   }   