#include <bits/stdc++.h>

/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define nul(x) memset((x),0,sizeof((x)))
#define random_jbt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using namespace std;

set<pair<double,pair<int,double>>>s[100100];
int w,h,r,q;
double d[100100];
map<int,int>m[100100];

void calc(int x,int y,int tresi){
    double l=0,k_down,k_up;
    for (int i=0;i<r;i++){
        k_down = (double)y - sqrt((double)(r*r) - l*l);
        k_up = (double)y + sqrt((double)(r*r) - l*l);
        l++;

        //PROMENIO SAM 1 i 0
        //PRVO IDE ZATVARANJE PA OTVARANJE
        s[x-i*tresi].insert({k_down,{1,k_up}});
        s[x-i*tresi].insert({k_up,{0,k_down}});

        auto it=s[x-i*tresi].find({k_down,{1,k_up}});
        auto it_2 = it;it_2++;

        if (it_2 -> fi == k_up){
            auto it_3 = it_2;
            it_2++;
            if (it_2!=s[x-i].end()){
                if (it_2->fi >= k_up and it_2->se.se <= k_down){
                    s[x-i*tresi].erase(it_3);
                    s[x-i*tresi].erase(it);
                    continue;
                }
            }
            d[x-i*tresi]-=(min(k_up,(double)h)-max(k_down,0.0));
            continue;
        }
        auto it_3 = it;it_3++,it_3++;
        if (it_3 -> fi == k_up){
            if (it_2 -> se.fi == 0){
                d[x-i*tresi]-=(min(k_up,(double)h) - max(it_2->fi,0.0));
                s[x-i*tresi].erase(it_2);
                s[x-i*tresi].erase(it);
            }
            else{
                d[x-i*tresi]-=(min(it_2->fi,(double)h) - max(k_down,0.0));

                s[x-i*tresi].erase(it_3);
                s[x-i*tresi].erase(it);
            }
            continue;
        }
        auto it_4 = it_3;it_4++;

        s[x-i*tresi].erase(it_4);
        s[x-i*tresi].erase(it_3);
        s[x-i*tresi].erase(it_2);
        s[x-i*tresi].erase(it);
    }
}

int main() {
    //ios;

    scanf("%d",&w);
    scanf("%d",&h);
    scanf("%d",&r);
    scanf("%d",&q);
    for (int i=0;i<=w;i++){
        d[i]=(double)h;
    }

    while(q--){
        int t;scanf("%d",&t);
        if (t==1){
            int x,y;
            scanf("%d",&x);
            scanf("%d",&y);

            auto nadji = m[x].find(y);
            if (nadji!=m[x].end())continue;
            m[x][y]=1;

            calc(x,y,1);
            calc(x,y,-1);
        }
        else{
            int x;
            scanf("%d",&x);
            printf("%.12f",d[x]);
            printf("\n");
        }
    }
    return 0;
}