#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;
            for(ll i = max((double)0, (double)x-r); i <= min((double)w,(double)x+r); i++)
            {
                double kat = x-i;
                ar[i] = min(ar[i], y - sqrt(r*r - kat*kat));
            }
        }
    }

}