#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

int main()
{
    ll w, h, r , q;

    cin >> w >> h >> r >> q;

    ld ar[w+1];
    for(ll i = 0; i <= w; i++)
    {
        ar[i] = h;
    }

    ll a;
    ld x,y;
    while(q--)
    {
        cin >> a;

        if(a == 2)
        {
            ll t;
            cin >> t;
            printf("%.12lf", ar[t]);
            cout << "\n";
        }
        else
        {
            cin >> x >> y;
            for(ll i = max((ld)0, (ld)x-r); i <= min((ld)w,(ld)x+r); i++)
            {
                ld kat = x-i;
                ar[i] = min(ar[i], y - sqrt(r*r - kat*kat));
            }
        }
    }

}