#include <bits/stdc++.h>

using namespace std;

typedef long double decimal;

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

    int64_t w, h, r, q;
    cin >> w >> h >> r >> q;
    int64_t cx = 0;
    int64_t cy = 0;

    vector<decimal> circ_len(r + 1, 0);
    vector<decimal> keks(w + 1, (decimal)h);
    bool circ_c = false;

    for(auto i = 0; i < q; i++)
    {
        int64_t q0;
        cin >> q0;
        if(q0 == 2)
        {
            int64_t x;
            cin >> x;
            if(circ_c)
            {
                if(!(x < cx - r || x > cx + r))
                    keks[x] = max((decimal)0, min(keks[x], cy - circ_len[r - abs(cx - x)]));
            }
            cout << setprecision(12) << keks[x] << '\n';
        }
        else if(q0 == 1)
        {
            cin >> cx >> cy;
            if(!circ_c)
            {
                int64_t bcr = cx - r;
                for(auto i = r; i >= 0; i--)
                    circ_len[i] = sqrt((r * r) - (cx - i - bcr) * (cx - i - bcr));
                circ_c = true;
            }
        }
    }

    cout.flush();
    return 0;
}