#include <stdio.h>

int main() {
    char phone[11];
    int num;
    scanf("%s %d", phone, &num);

    if (num == -1) {
        printf("%s", phone);
        return 0;
    }

    else if (-1 < num < 10) {
        printf("%d", phone[num]);
        return 0;
    }

    else {
        printf("ERROR");
        return 1;
    }
    
}