#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

struct tacka
{
    int x;
    int y;
};
vector<tacka> c;

long double presek( tacka c, int r, int x )
{
    long double s = c.x - x;
    return c.y - sqrt( r*r - s*s );
}

void duz( int r, int h )
{
    int x;
    long double d = h;
    cin >> x;
    for( int i = 0; i < c.size(); i++ )
        d = min( d, presek( c[i], r, x ) );
    cout << fixed << setprecision(12) << d << endl;
}

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int w, h, r, q, x, t;
    tacka f;

    cin >> w >> h >> r >> q;
    while(q--)
    {
        cin >> t;
        if( t == 1 )
        {
            cin >> f.x >> f.y;
            c.push_back(f);
        }
        else
            duz(r, h);
    }

    return 0;
}