#include <bits/stdc++.h>   using namespace std;   int main() {     long long k, m = 9, x;     long long r = 1, n, j, d = 0;     cin >> k;     while (k - m * r > 0) {       k -= m * r;       ++r;       m = m * 10;     }     n = (k - 1) / r;     j = (k - 1) % r;     x = pow(10, r - 1) + n;     for (long i = 0; i < r - j - 1; ++i) x /= 10;     d = x % 10;     cout << d << endl;     return 0;   }   