#include <bits/stdc++.h>
using namespace std;

vector<vector<float> > duz;
void merger(float a, float b) {
    int donji=-1;
    int gornji=-1;
    for (int i=0;i<duz[0].size();i++) {
        if (a>=duz[0][i]&&a<=duz[1][i]) {
            donji=i;
        }
        if (b>=duz[0][i]&&b<=duz[1][i]) {
            gornji=i;
        }
        if (a<duz[0][i]&&b>duz[1][i]) {
            duz[0].erase(duz[0].begin()+i);
            duz[1].erase(duz[1].begin()+i);
        }
    }
    if (gornji==-1&&donji==-1) {
        duz[0].push_back(a);
        duz[1].push_back(b);
    }
    else if (gornji!=-1&&donji==-1) {
        duz[0][gornji]=a;
    }
    else if (donji!=-1&&gornji==-1) {
        duz[1][donji]=b;
    }
    else if (gornji!=donji) {
        duz[1][donji]=duz[1][gornji];
        duz[0].erase(duz[0].begin()+gornji);
        duz[1].erase(duz[1].begin()+gornji);
    }
    else {
        return;
    }
}
int main() {
    int w,h,r,q,num;
    double a,b,x,y,res;
    vector<vector<double> > kor;
    duz.resize(2);
    kor.resize(2);
    scanf ("%d %d %d %d",&w,&h,&r,&q);
    for (int i=0; i<q;i++) {
        scanf (" %d",&num);
        if (num==1) {
            scanf(" %lf %lf",&x,&y);
            kor[0].push_back(x);
            kor[1].push_back(y);
        }
        else {
            duz[0].clear();
            duz[1].clear();
            scanf (" %lf",&x);
            if (kor[0].size()==0) {
                printf("%lf\n",(double)h);
            }
            else {
                b=sqrt(r*r-(x-kor[0][0])*(x-kor[0][0]))+kor[1][0];
                a=-sqrt(r*r-(x-kor[0][0])*(x-kor[0][0]))+kor[1][0];
                if (b>h) b=h;
                if (a>h) a=h;
                duz[0].push_back(a);
                duz[1].push_back(b);
                for (int k=1;k<kor[0].size();k++) {
                    b=sqrt(r*r-(x-kor[0][k])*(x-kor[0][k]))+kor[1][k];
                    a=-sqrt(r*r-(x-kor[0][k])*(x-kor[0][k]))+kor[1][k];
                    merger(a,b);
                }
                res=(double)h;
                for (int k=0; k<duz[0].size();k++) {
                    res=res-(duz[1][k]-duz[0][k]);
                }
                printf("%.12lf\n",res);
            }
        }
    }
}