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

int main()
{
	long unsigned int W, H, R, Q,coordinate,p,q,output_size;
	long unsigned i,j;
	long double y1, y2,y_part;
	int input_case;
	std::vector<long double> y,output;


	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) {
			std::cin >> coordinate;
			output.push_back (y[coordinate]);
		}
		else {
			std::cin >> p;
			std::cin >> q;
			
			for (j = 0; j < W; j++) {
				y_part = sqrt(4 * pow(q, 2) - 4 * (pow(j, 2) -2*j*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) {
					y[j] = y1;
				}
				else {
					if (y2 < H && y2 > 0) {
						y[j] = y2;
					}
				}
			}
		}
	}
	output_size = output.size();

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

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

	}
}