#include <iostream>
#include <string>
#include <cmath>
using namespace std;
using ll=long long;
int main() {
ios::sync_with_stdio(false);cin.tie(nullptr);
int n; cin>>n;
ll len=0;
int digit=1;
ll count=9;
while (n>len+digit*count) {
len+=digit*count;
++digit;
count*=10;
}
ll remain=n-len;
ll num=(ll)pow(10,digit-1)+(remain-1)/digit;
int pos=(remain-1)%digit;
string s=to_string(num);
cout<<s[pos]<<'\n';
return 0;
}

京公网安备 11010502036488号