#include <iostream>
#include <limits>
#include <cmath>
#include <iomanip>;

using namespace std;

typedef numeric_limits<streamsize> ignore_t;

double jednacina(double H, int R, int p, int q, int x) 
{
	double y1 = ((q * 2) + sqrt(pow(q * 2, 2) - 4 * (pow(x - p, 2) - pow(R, 2) + pow(q, 2))))/2;
	double y2 = ((q * 2) - sqrt(pow(q * 2, 2) - 4 * (pow(x - p, 2) - pow(R, 2) + pow(q, 2))))/2;

	if (y1 >= 0 && y1 <= H)
		return y1;
	else if (y2 >= 0 && y2 <= H)
		return y2;
	else return 0;
}

int main()
{
	int W{}, R{}, Q{};
	double H{};

	scanf("%d %lf %d %d", &W, &H, &R, &Q);

	int** koraci = new int*[Q];

	int n{3};
	for (int i{}; i < Q; ++i) 
	{
		koraci[i] = new int[3];
		for (int j{}; j < n; ++j) 
		{
			cin >> koraci[i][j];
			if (koraci[i][0] == 1)
				n = 3;
			else 
				n = 2;
		}
		cin.ignore(ignore_t::max(), '\n');	
	}
	int p{}, q{};
	double y{};

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

	for (int i{}; i < Q; ++i) 
	{
		switch (koraci[i][0]) 
		{
		case 1:
			p = koraci[i][1];
			q = koraci[i][2];
			break;
		case 2:
			if (p == 0 && q == 0) 
				cout << H << '\n';
			else 
			{
				y = jednacina(H, R, p, q, koraci[i][1]);
				if(y == 0)
					cout << H << '\n';
				else
					cout << y << '\n';
			}
			break;
		}
	}

	cin.clear();
	cin.ignore(ignore_t::max(), '\n');
	cin.get();
	
	return 0;
}