#include <bits/stdc++.h>

#define pb push_back
#define mt make_tuple
#define ld long double

using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int w, h, r, q;
    cin >> w >> h >> r >> q;

    vector< tuple<int, int, int> > operations;
    vector<int> x;
    while(q--) {
        int o;
        cin >> o;

        int xi, yi = -1;
        if(o == 1) {
            cin >> xi >> yi;
        } else {
            cin >> xi;
            x.pb(xi);
        }

        operations.pb(mt(o, xi, yi));
    }
    sort(x.begin(), x.end());

    ld height[w + 1];
    for(int i = 0; i <= w; i++)
        height[i] = h;
    for(auto oper: operations) {
        int o, xi, yi;
        tie(o, xi, yi) = oper;

        if(o == 2) {
            cout << fixed << setprecision(12) << height[xi] << endl;
            continue;
        }

        int first = (lower_bound(x.begin(), x.end(), xi - r) - x.begin());
        int mid = (lower_bound(x.begin(), x.end(), xi) - x.begin());
        int last = (lower_bound(x.begin(), x.end(), xi + r) - x.begin());
        for(int i = mid; i < last; i++) {
            ld dx = abs(xi - i), dy = yi - h;
            ld diff = sqrt(r * r - dx * dx) - dy;
            if(diff <= 0)
                break;
            height[i] = min(height[i], h - diff);
        }
        for(int i = mid - 1; i >= first; i--) {
            ld dx = abs(xi - i), dy = yi - h;
            ld diff = sqrt(r * r - dx * dx) - dy;
            if(diff <= 0)
                break;
            height[i] = min(height[i], h - diff);
        }
    }
    return 0;
}