#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <limits>
#include <iomanip>

using namespace std;

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

    long w,h,r,q;
    cin >> w >> h >> r >> q;
    vector<pair<long,long> > v;
    for (long t=0;t<q;t++)
    {
        long d;
        cin >> d;
        if (d==1)
        {
            long x,y;
            cin >> x >> y;
            v.push_back({x,y});
        }
        else
        {
            long ind;
            cin >> ind;
            long m=v.size();
            double mx=h;
            for (long i=0;i<m;i++)
            {
                long x=v[i].first,y=v[i].second;
                double cur=-sqrt(r*r-(x-ind)*(x-ind))+y;
                if (cur<0) cur=0;
                if (cur<mx) mx=cur;
            }
            cout << setprecision(std::numeric_limits<long double>::digits10 + 1) << mx << "\n";
        }
    }
    return 0;
}