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

using namespace std;

int main() {

    long w, r, q, h;

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

    long double arr[q] = {};
    long centerX, centerY;

    bool called = false;
    long brojac = 0;

    for (long i = 0; i < q; i++) {
        long type;
        cin >> type;

        if (type == 1) {
            long y;
            long x;

            called = true;
            cin >> x;
            cin >> y;

            centerX = x;
            centerY = y;

        } else if (type == 2) {
            long x;
            cin >> x;

            if (!called) {
                cout << fixed << showpoint;
                arr[i] = (double) h;
            } else {
                cout << fixed << showpoint;
                long c = pow(centerY, 2) + pow(x - centerX, 2) - pow(r, 2);
                long b = (long) -1 * 2 * centerY;
                long double finalX = (long double) (-b - (long double) sqrt(pow(b, 2) - 4 * 1 * c)) / 2;
                arr[brojac] = min(finalX, (long double) h);
            }

            brojac += 1;
        }
    }

    for (long i = 0; i < brojac; i++) {
        cout << setprecision(9) << arr[i] << endl;
    }
    return 0;
}