#include <bits/stdc++.h>

using namespace std;

void Gric(long double a[], int q, int x, int y, int r, int w, int h)
{
    for(int j = 0; j < w; j++)
    {
        if (j >= x - r)
            a[j] = fmin(y - sqrt(r*r - (r - (j - (x - r)))*(r - (j- (x - r)))), a[j]);
    }
}

long double Merenje(long double a[], int x)
{
    return a[x];
}


int main()
{
    cout.precision(10);
    int w, h;
    cin >> w >> h;
    int r, q;
    cin >> r >> q;
    long double a[w];
    int b[3][q];
    for(int i = 0; i < q; i++)
    {
        cin >> b[0][i];
        if (b[0][i] == 1)
            cin >> b[1][i] >> b[2][i];
        else
            cin >> b[1][i];
    }

    for (int i = 0; i < w; i++)
        a[i] = h;

    for (int i = 0; i < q; i++)
    {
        if (b[0][i] == 1)
            Gric(a, q, b[1][i], b[2][i], r, w, h);
        else
            cout << fixed << setprecision(10) << Merenje(a, b[1][i]) << endl;
    }
}