#include<cmath>
#include<bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
    int w,h,r,q,izbor,xc,yc,xi,uslovdod,xhelp;
    double mod;
    cin>>w>>h>>r>>q;
    vector<double> ispis;
	vector<double> kegz;
	kegz.assign(w+1,h);
    for (int i=0; i<q;i++)
	{
		cin>>izbor;
		if(izbor==1)
		{
			cin>>xc>>yc;
			uslovdod=(r*r)-(h-yc)*(h-yc);
			if(uslovdod>0)
			{
				for(int i=(xc-sqrt(uslovdod)+1);i<=xc;i++)
				{
					kegz[i]=yc-sqrt(r*r-(xc-i)*(xc-i));
				}	
			
				for(int i=xc+1;i<xc+sqrt(uslovdod);i++)
				{
					kegz[i]=yc-sqrt(r*r-(xc+i)*(xc+i));
				}					
			}
		}
		else
		{
			cin>>xi;
			ispis.push_back(kegz[xi]);
			
		}
	}
	for(int i=0;i<ispis.size();i++)
	{
		cout<<ispis[i];
	}
	
        
    return 0; 
}