#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>

long double calculate(long unsigned int H, long unsigned int R, long unsigned int p, long unsigned int q, int xi);

class centar_kruznice {
public:
	int p, q;
};
class output_data {

public:
	int number_of_calculations, xi;
};

int main()
{
	long unsigned int W, H, R, Q,coordinate,p,q,output_size;
	long unsigned i,j;
	long double temp;
	int input_case,pq_counter = 0,number_of_outputs = 0;
	std::vector<long double> y,output;
	std::vector<centar_kruznice> PQ;
	std::vector<output_data> list_output_data;


	std::cin >> W;
	std::cin >> H;
	std::cin >> R;
	std::cin >> Q;

	for (i = 0; i < W; i++) {
		y.push_back(H);
	}

	for (i = 0; i < Q; i++) {
		std::cin >> input_case;
		if (input_case == 2) {
			output_data obj;
			std::cin >> obj.xi;
			obj.number_of_calculations = pq_counter;
			list_output_data.push_back(obj);

			number_of_outputs++;
		}
		else {
			centar_kruznice ck;
			std::cin >> ck.p;
			std::cin >> ck.q;
			PQ.push_back(ck);
			pq_counter++;
		}
	}

	for (i = 0; i < number_of_outputs; i++) {
		for (j = 0; j < list_output_data[i].number_of_calculations; j++) {
			temp = calculate(H, R, PQ[j].p, PQ[j].q, list_output_data[i].xi);
			if (temp != NULL) {
				y[list_output_data[i].xi] = temp;
			}
		}
		output.push_back(y[list_output_data[i].xi]);
	}

	output_size = output.size();

	std::cout << std::fixed;
	std::cout << std::setprecision(12);

	for (i = 0; i < output_size; i++) {
		std::cout << output[i] << std::endl;

	}
}


long double calculate(long unsigned int H, long unsigned int R, long unsigned int p, long unsigned int q, int xi) {
	long double y_part,y1,y2;
	y_part = sqrt(4 * pow(q, 2) - 4 * (pow(xi, 2) - 2 * xi*p + pow(p, 2) + pow(q, 2) - pow(R, 2)));
	y1 = (2 * q - y_part) / 2;
	y2 = (2 * q + y_part) / 2;
	if (y1 < H && y1 > 0) {
		return y1;
	}
	else {
		if (y2 < H && y2 > 0) {
			return y2;
		}
		else {
			return NULL;
		}
	}
	
}