#include <stdio.h>

int main() {
    char phone[11];
    int i;
    scanf("%10s %d", phone, &i);
    if (i == -1) {
        printf("%s\n", phone);
        return 0;
    } else if (i >= 0 && i <= 9) {
        printf("%c\n", phone[i]);
        return 0;
    } else {
        printf("ERROR\n");
        return 1;
    }
}

output the digit at index i