#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
    long int w, h, r, q;
    cin >> w >> h >> r >> q;
    long double visina[w + 1];
    for(long int i = 0 ; i < w + 1 ; i++) {
        visina[i] = h;
    }
    for(long int i = 0 ; i < q ; i++) {
        int a;
        long int b, c;
        cin >> a;
        if(a == 1) {
            cin >> b >> c;
            for(long int i = 0 ; i < w + 1 ; i++) {
                if(c - r < visina[i] && c > -r){
                    if(r > abs(b - i) && b >= -r) {
                        visina[i] -= sqrt(pow(r, 2) - pow(abs(b - i) , 2)) - c + visina[i];
                    }
                }
                if(visina[i] < 0) visina[i] = 0;
                else if(visina[i] > h) visina[i] = h;
            }
        }if(a == 2) {
            cin >> b;
            cout << setprecision(12) << fixed << showpoint << visina[b] << endl;
        }
    }
    return 0;
}