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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    int w,h,r,q;
    cin>>w>>h>>r>>q;
    int help,help2;
    vector<pair<long double,long double> > data[w+1];
    for(int i=0;i<q;i++)
    {
        cin>>help;
        if(help==1)
        {
            cin>>help>>help2;
            for(int j=max(help-r,0);j<=min(w,help+r);j++)
            {
                long double manji=help2-sqrt((r-help+j)*(r+help-j));
                long double veci=help2+sqrt((r-help+j)*(r+help-j));
                if(manji<(long double)h && veci>(long double)0)
                {
                    pair<long double,long double> helpair;
                    /*sort(data[j].begin(), data[j].end());
                    int cnt=0;
                    for(int k=0;k<data[j].size();k++)
                    {
                        
                    }*/
                    helpair.first=max((long double)0,manji);
                    helpair.second=min((long double)h,veci);
                    data[j].push_back(helpair);
                    //cout<<"krug dodavanje "<<manji<<" "<<veci<<"\n";
                }

            }
        }
        else
        {
            cin>>help2;
            long double helperino=h;
            for(int j=0;j<data[help2].size();j++)
            {
                helperino-=data[help2].at(j).second-data[help2].at(j).first;
                //cout<<helperino<<" "<<data[help2].at(j+1)<<" "<<data[help2].at(j)<<"\n";
            }
            cout<<setprecision(9)<<helperino<<"\n";
        }
    }
}