#include <bits/stdc++.h>

using namespace std;

long double rez[100001];

int main()
{
    int w, h, r, q;
    cin >> w >> h >> r >> q;
    std::cout << std::fixed;
    std::cout << std::setprecision(12);
    for(int i = 0; i <= w; i++)rez[i] = h;
    for(int i = 0; i < q; i++){
        int t;
        cin >> t;
        if(t == 1){
            int x, y;
            cin >> x >> y;
            int dx = sqrt(r-y+h)*sqrt(y-h+r);
            for(int s = x-dx; s <= x+dx; s++){
                rez[s] = min((long double)(y-sqrt(r-abs(x-s))*sqrt(r+abs(x-s))), rez[s]);
            }
        }else{
            int x;
            cin >> x;
            cout << rez[x] << "\n";
        }
    }
    return 0;
}