#include <bits/stdc++.h>

using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long r,q;
    long double w,h;
    cin>>w>>h>>r>>q;
    vector<pair<int,int>> v;
    int n=w;
    long double xw[n+1];
    for(int i=0;i<n;i++)
        xw[i]=h;
    for(int i=0;i<q;i++)
    {
        int t;
        long double x,y;
        cin>>t;
        if(t==1)
        {
            cin>>x>>y;
            for(long double i=x-r;i<=x+r;i++)
            {
                int ind=i;
                long double ch;
                long double qf=sqrt(r*r-(x-i)*(x-i));
                ch=min(h,y-qf);
                xw[ind]=min(xw[ind],min(h,ch));
            }
        }
        else
        {
            cin>>x;
            int xx=x;
            printf("%.12lf",xw[xx]);
            //cout<<xw[xx]<<"\n";
        }
    }
}