#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w;
	cin>>h>>w;
	int r;
	cin>>r;
	int tt;
	cin>>tt;
	vector<int> x; 
	int pos[w]={-1};
	cout<<fixed<<setprecision(9);
	double tr[h+1];
	int i;
	for(i=0;i<=h;i++)
		tr[i]=w;
	while(tt--)
	{
		int tip;
		cin>>tip;
		if(tip==1)
		{
			int a,b;
			cin>>a>>b;
			x.push_back(a);
			int j;
			if(pos[a]>b || pos[a]==-1)
			{       
				for(j=0;j<r;j++)
				{
					if(a+j<=h)
						tr[a+j]=min(tr[a+j],b-sqrt(r*r-j*j));
					if(a-j>=0)
						tr[a-j]=min(tr[a-j],b-sqrt(r*r-j*j));
				}
				pos[a]=b;
			} 
		}
		else
		{
			int a;
			cin>>a;       
			cout<<tr[a]<<endl;
		}
	}
}