#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int w, h, r, q, a, b, x, y;
	double d, g;
	cin >> w >> h >> r >> q;
	double nizh[w+1];
	for(int i=0; i < w+1; i++)
	{
		nizh[i] = h;
	}
	for(int i=0; i < q; i++)
	{
		cin >> a;
		if(a == 2)
		{
			cin >> b;
			printf("%.8f", nizh[b]);
			cout << endl;
		}
		else
		{
			cin >> x >> y;
			for(int i=0; i < w+1; i++)
			{
				d = sqrt((i - x)*(i - x) + (y - nizh[i])*(y - nizh[i]));
				if(d < r)
				{
					g = y - sqrt(r*r - (x - i)*(x - i));
					if(g < 0)
					{
						g = 0;
					}
					nizh[i] = g;
				}
			}
		}
	}
	
	return 0;
}