#include <bits/stdc++.h>

using namespace std;

int main()
{
    int w, h, r, q;
    cin >> w >> h >> r >> q;
    vector<long double> a(w+1, h);
    while (q--){
        int type;
        cin >> type;
        if (type == 1){
            int x, y;
            cin >> x >> y;
            int diff = y - h;
            if (h - a[x] < r) a[x] = h - r + diff;
            for (int i = 1; i <= r - diff; ++i){
                double raz = sqrt(- i * i + r * r);
                if (x-i >= 0 && h - a[x-i] < raz) a[x-i] = h - raz + diff;
                if (x+i <= w && h - a[x+i] < raz) a[x+i] = h - raz + diff;
            }
        }
        else {
            int x;
            cin >> x;
            cout << setprecision(8) << a[x] << endl;
        }
    }
    return 0;
}