#include <bits/stdc++.h>
#define ull unsigned long long
#define ld long double
using namespace std;
int main () {
    ios_base::sync_with_stdio(false);
    ull w,h,r,q;
    cin >> w >> h >> r >> q; 
    ld v[w+1];
    ld ht,xr;
    vector<ld>merenja;
    for (int i = 0 ; i <= w ; i++ ) {
        v[i] = h;
    }
    int x,y,a;
    for (int i = 0 ; i < q; i++ ) {
        cin >> a ;
        if ( a == 2 ) {
            cin >> x ;
            merenja.push_back(v[x]);
        }
        else {
            cin >> x >> y ;
            for (int j = x-r; j<= x+r ; j++ ) {
                if ( j >= 0 && j <= w ) {
                    // izracunaj
                    xr = abs(x-j);
                    ht = sqrtl(r*r-xr*xr);
                    v[j] = min(y-ht,v[j]);
                }
            }
        }
    }
    
    for (int i = 0 ; i < merenja.size() ; i++ ) {
        cout <<fixed << setprecision(10) << merenja[i] << endl ;
    }
}