#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <cmath>
#include "testlib.h"

using namespace std;

int main(int argc, char ** argv) {
	registerInteraction(argc, argv);
	int queries = 0;
	int N = inf.readInt();
	int R = inf.readInt();
	int X = inf.readInt();
	int Y = inf.readInt();
	inf.readEoln();
	while (true) {
		queries++;
		if (queries > N) {
			quitf(_wa, "queries limit");
		}
		char c = ouf.readChar();
		if (c == '!') {
		    int r = ouf.readInt();
		    ouf.readEoln();
			if (R==r) {
				quitf(_ok, "Ok");
			}
			else {
				quitf(_wa, "WA: expected %d, found %d", R, r);
			}
		}
		else {
			if (c == '?') {
			    int x = ouf.readInt();
		        int y = ouf.readInt();
		        ouf.readEoln();
				int d = 0;
				if((X-x)*(X-x)+(Y-y)*(Y-y)<=R*R)
				    d = 1;
				cout << d << endl;
				cout.flush();
			}
			else {
				quitf(_wa, "incorrect query");
			}
		}
	}
	return 0;
}