#include <iostream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
using namespace std;
main(){
	int w,h,q,temp,tempkord,b=0;
	double min,razd,r;
	vector<double> v;
	cin>>w>>h>>r>>q;
	vector<double> resenja;
	for(int i = 0;i<q;i++){
		cin>>temp;
		if(temp==1){
			//grickanje
			b++;
			cin>>tempkord;
			v.push_back(tempkord);
			cin>>tempkord;
			v.push_back(tempkord);
		}
		if(temp==2){
			//merenje
			cin>>tempkord;
			min=h;
			for(int y=0;y<b;y++){
				/*cout<<"calc:"<<endl;
				cout<<"v glasi, od 0 do 1"<<v[0]<<", "<<v[1]<<endl;
				cout<<"v[y*2+1] je "<<fixed<<v[y*2+1]<<endl;
				cout<<"sqrt(r*r-(v[y*2]-tempkord)*(v[y*2]-tempkord)) je "<<fixed<<sqrt(r*r-(v[y*2]-tempkord)*(v[y*2]-tempkord))<<endl;
				cout<<"r*r-(v[y*2]-tempkord)*(v[y*2]-tempkord) je "<<fixed<<r*r-(v[y*2]-tempkord)*(v[y*2]-tempkord)<<endl;
				cout<<"r*r2 je "<<r*r<<endl;
				cout<<"v[y*2] je "<<v[y*2]<<endl;
				cout<<"y*2+1 je "<<y*2+1<<endl;
				cout<<"tempkord je "<<tempkord<<endl;
				cout<<"(v[y*2]-tempkord) je "<<fixed<<(v[y*2]-tempkord)<<endl;*/
				razd = (v[y*2+1] - sqrt(r*r-(v[y*2]-tempkord)*(v[y*2]-tempkord)));
				//cout<<"razd je "<<fixed<<razd<<endl;
				if(razd<min){
					min=razd;
				}
				
				
			}
			//cout<<fixed<<min;
			resenja.push_back(min);
		}
	}
	for(int p = 0;p<q-b;p++){
		cout<<setprecision(20)<<resenja[p]<<endl;
	}
}