#include <bits/stdc++.h>

using namespace std;

int W,H,R,Q;
int x,y,q;
long double mat[100008];
vector<long double> res;
int main()
{

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

    for(int i = 0; i <= W; i++){
        mat[i] = H;
    }

    for(int i = 0; i < Q; i++){
        cin >> q;
        if(q == 1){

            cin >> x >> y;

            if(R==1){
                if(x <= W){
                    if(mat[x] > y - 1)
                        mat[x] = y - 1;
                    if(mat[x] < 0)
                        mat[x] = 0;
                }

            }

            else if(R == 2){

                if(mat[x] > y - 2)
                    mat[x] = y - 2;
                if(mat[x] < 0)
                    mat[x] = 0;

                if(mat[x - 1] > y - sqrt(3))
                    mat[x - 1] = y - sqrt(3);
                if(mat[x-1] < 0)
                    mat[x - 1] = 0;

                if(mat[x + 1] > y - sqrt(3))
                    mat[x + 1] = y - sqrt(3);
                if(mat[x+1] < 0)
                    mat[x+1] = 0;
            }

            else{
                if(mat[x] > y - R)
                    mat[x] = y - R;
                if(mat[x] < 0)
                    mat[x] = 0;

                for(int i = 1; i < R; i++){
                    if(mat[x-i] > y - sqrt(R*R - i*i))
                        mat[x - i] = y - sqrt(R*R - i*i);
                    if(mat[x - i] < 0)
                        mat[x - i] = 0;

                    if(mat[x+i] > y - sqrt(R*R - i*i))
                        mat[x + i] = y - sqrt(R*R - i*i);
                    if(mat[x + i] < 0)
                        mat[x + i] = 0;
                }
            }
        }
        else{
            cin >> x;
            res.push_back(mat[x]);
        }
    }
    cout.precision(12);
    for(int i = 0; i < res.size(); i++){
        cout << fixed << res[i] << "\n";
    }

    return 0;
}