#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
struct krug
{
int x,y;
};
struct nzz
{
double v;
int n;
};
krug niz[100000];
nzz duz[100000];
int main()
{
/*	ios::sync_with_stdio(0);
	cout.tie(0);(double)sqrt(((double)(niz[k].y*niz[k].y)-(double)(abs(xi-niz[k].x*xi-niz[k].x))))
	cin.tie(0);*/
int l,h,n,r,i,p=0,k=0,xi;                                                                                                                           
cin>>l>>h>>r>>n;
//r=r*r;	
cout<<r;																																																																	for(i=0;i<100000;i++){duz[i].n=0;duz[i].v=h;}                                                                                                                           
for(i=0;i<n;i++)	
{
	cin>>p;
	if(p==1)
	{
		cin>>niz[k].x>>niz[k].y;
		k++;
	}
	if(p==2)
	{
		cin>>xi;
			for(i=duz[xi].n;i<k;i++)
			{
				if(duz[xi].v>(double)(niz[i].y-(double)sqrt(r-(abs(xi-niz[i].x)*abs(xi-niz[i].x)))))duz[xi].v=(double)(niz[i].y-(double)sqrt(r-(abs(xi-niz[i].x)*abs(xi-niz[i].x))));
			//	cout<<(double)(niz[i].y-(double)sqrt(r-(abs(xi-niz[i].x)*abs(xi-niz[i].x))));
				}
				duz[xi].n=i;
				cout<<duz[xi].v;
				
				
			}
		
	}
}