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

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int w,h,r,x,y,l,d,rast;
    int q,xk;
    cin >> w >> h >> r >> q;
    double h1=(double)h;
    vector<double>v(w,h1);
    for (int i=0;i<q;i++)
    {
        cin >> d;
        if (d==1)
        {
            cin >> x >> y;
            l=max(x-r+1,0);
            d=min(x+r-1,w);
            for (int j=l;j<=d;j++)
                {
                    rast=abs(x-j);
                    double RR=sqrt(r*r-rast*rast);
                    v[j]=(double)y-RR;
                }
        }
        else
        {
            cin >> xk;
            cout << fixed << showpoint << setprecision(10) << v[xk] << '\n';
        }
    }
}