#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    long long int w,h,r,q; cin>>w>>h>>r>>q;
    int l;
    long long int xr,yr,trazeni;
    double y[w];
    vector<double> resenja;
    long long int x[w];

    for(long long int i=0;i<w;i++) y[i] = h;

    for(long long int i=0;i<q;i++) {
        cin>>l;

        if(l == 1){
            cin>>xr>>yr;
            for(long long int i=0;i<w;i++){
                if(sqrt(r*r - (abs(xr-i)*abs(xr-i))) != 0) y[i] = yr -sqrt(r*r - (abs(xr-i)*abs(xr-i)));
            }
        }

        else if(l == 2){
            cin>>trazeni;
            resenja.push_back(y[trazeni]);
        }
    }

    for(long long int i=0;i<resenja.size();i++) cout<<resenja[i]<<endl;

    return 0;
}