#include <bits/stdc++.h>
#include <climits>

#include <math.h>
using namespace std;

int main()
{
    int w,h,r,q,br,x,y;
    cin>>w>>h>>r>>q;
    long double visine[w+1];
    for(int i=0;i<w+1;i++){
        visine[i]=h;
    }
    for(int i=0;i<q;i++){
        cin>>br>>x;
        if(br==1){
            cin>>y;
            int j=x-r;
            if(j<0)j=0;
            for(;j<=x+r&&j<=w;j++){
                long double b=-(2*(double)y);
                long double c=(double)y*(double)y-((double)r*(double)r)+((double)j*(double)j)-(2*(double)x*(double)j)+((double)x*(double)x);
                long double v=(-b-sqrt((b*b)-(4*c)))/2;
                if(v<visine[j])visine[j]=v;
            }
        }
        else{
            cout<<std::setprecision(15)<<visine[x]<<endl;
        }
    }
    return 0;
}