#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

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

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

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

}

/*
3 2 3 5
2 1
1 2 3
2 0
2 1
2 2
*/