#include <bits/stdc++.h>

using namespace std;

int main()
{

    int w,h,r,q;

    cin >> w >> h >> r >> q ;

    double konacno[w+1] = {0};

    for(int i = 0 ; i <= w ; ++i)
    {
        konacno[i] += h;
    }



    while(q--)
    {
        int pr,ind;
        double x1, x2 ;

        cin >> pr;

        if(pr == 1)
        {
            cin >> x1 >> x2;

            double lS;

            for(int i = 0 ; i <= w; ++i)
            {

                lS = x1 - i;

                double medjuV = x2 - sqrt(r*r - lS*lS);



                if (konacno[i] >=  medjuV)
                {
                    konacno[i] = medjuV;
                }
                if(konacno[i] < 0)
                    konacno[i] = 0;


            }


        }
        else if(pr == 2)
        {
            cin >> ind;
            printf("%.12f",konacno[ind]),printf("\n");
        }
    }


    return 0;
}