#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
    int W,H,R,Q,a=0;
    cin >> W >> H >> R >> Q;
    int dim[Q][2];
    int mer[Q];
    int redosled[Q];
    for (int i=0;i<Q;i++) {
        cin >> a;
        if (a == 1) {
            cin >> dim[i][0];
            cin >> dim[i][1];
            redosled[i] = 1;

        }
        if (a == 2) {
            cin >> mer[i];
            redosled[i] = 2;

        }
    }
    long double resenje;
    for (int i=0;i<Q;i++) {
        if (redosled[i] == 2) {
            if (i==0 || (i==0 && redosled[i-1] == 2) || (i==0 && redosled[i-2] == 2 && redosled[i-1] == 2)) {
                cout << H << endl;
            } else {
                if ((dim[i-1][0] - R) <= mer[i] ) {
                    cout << H << endl;
                }
                resenje = dim[i-1][1] - sqrt((R*R) - (dim[i-1][0] - mer[i]));
                cout << fixed << setprecision(10) << resenje;
            }
        }
    }


    return 0;
}