#include <bits/stdc++.h>
using namespace std;


int main()
{
    long long w,h,r,q,ind,x,y;
    cin>>w>>h>>r>>q;
    long double a[w+1];
    for(int i=0; i<=w; ++i) a[i]=h;
    long double l,p;
    while(q--) {
        cin>>ind;
        if(ind==1) {
            cin>>x>>y;
            long double l;
            for(long long i=x; i>=0 && (x-i)<=r;--i) {
                l=sqrt(r*r-(x-i)*(x-i));
                p=y-l;
                if(p>=h) break;
                a[i]=max(min(a[i],p),(long double)0);
            }
            for(long long i=x+1; i<=w && (i-x)<=r;++i) {
                l=sqrt(r*r-(x-i)*(x-i));
                p=y-l;
                if(p>=h) break;
                a[i]=max(min(a[i],p),(long double)0);
            }
        }
        else {
            cin>>x;
            cout<<fixed<<setprecision(10)<<a[x]<<endl;
        }
    }
    return 0;
}