#include <iostream>
#include <vector>
#include <algorithm>
#include<queue>
using namespace std;
const int N = 1e4 + 100;
string funk(int n){
string s;
while(n){
s = char(n%10+48) + s;
n/=10;
}
return s;
}
int main(){
int pos;
cin >> pos;
string s;
for(int i = 1;i<= pos;i++){
s+=funk(i);
}
cout<<s[pos-1];
}