#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
	char phone[11];
	int i;

	if (scanf("%10s %d", phone, &i) != 2) {
		return 0;
	}

	do {
		if (i < -1 || i > 9) {
			printf("ERROR\n");
			return 1;
		} else if (i == -1) {
			printf("%s\n", phone);
		} else { 
			printf("%c\n", phone[i]);
		}
	} while (scanf(" %d", &i) == 1);

	return 0;
}