#include <stdio.h>
#include <stdbool.h>
int main() {
	char phone[11];
	int readInt;
	bool wasError = false;
	while(scanf("%s", phone)==1){
		scanf("%d", &readInt);
		if (readInt == -1){
			printf("%s\n", phone);
		}
		else if (0 <= readInt && readInt <= 9) {
			printf("%c\n", phone[readInt]);
		}
		else {
			wasError = true;
			printf("%s\n", "ERROR");
		}
	}	
	if (wasError == false) {
		return 0;
	}
	else {
		return 1;
	}
}
$ ./phone_loop
4147891234
3
7
6
1
-1
4147891234
0
4
11
ERROR