#include <bits/stdc++.h>

using namespace std;

pair<long double, long double> intersection(uint32_t line_x, uint32_t circle_x, uint32_t circle_y, uint32_t cirlce_r);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    uint32_t W, H, R, Q;
    uint8_t type;

    cin >> W >> H >> R >> Q;

    pair<long double, long double> cookie[W];

    for(uint32_t i = 0; i < W; i++){
        cookie[i] = make_pair(0, H);
    }

    uint32_t x_i, y_i;
    pair<long double, long double> intersect;

    for(uint32_t i = 0; i < Q; i++){
        cin >> type;

        if(type == '1'){
            cin >> x_i >> y_i;
            //circles.push_back(make_pair(x_i, y_i));
            for(uint32_t j = x_i - R + 1; j < x_i + R; j++){
                intersect = intersection(j, x_i, y_i, R);

                if(intersect.first < 0 && intersect.second > 0){
                    cookie[j].first = max(cookie[j].first, intersect.second);
                }else if(intersect.first > 0 && intersect.second > 0){
                    cookie[j].second = min(cookie[j].second, intersect.first);
                }
            }
        }else{
            cin >> x_i;

            printf("%.12Lf\n", cookie[x_i].second - cookie[x_i].first);
        }
    }
}

pair<long double, long double> intersection(uint32_t line_x, uint32_t circle_x, uint32_t circle_y, uint32_t circle_r){
    return make_pair(circle_y - sqrt(circle_r * circle_r - (line_x - circle_x) * (line_x - circle_x)),
                     circle_y + sqrt(circle_r * circle_r - (line_x - circle_x) * (line_x - circle_x)));
}