#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
    int n;
    scanf("%d", &n);

    char shuzu[2000] = "";
    int num = 1;
    while (strlen(shuzu) < n) {
        char temp[20];
        sprintf(temp, "%d", num);
        strcat(shuzu, temp);
        num++;
    }
    printf("%c\n", shuzu[n - 1]);
    return 0;
}