#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
    long long w,h,r,q;
    scanf("%lld%lld%lld%lld", &w,&h,&r,&q);
    double a[w+10];
    for (long long i=0;i<=w;i++) a[i]=h;
    for (long long i=0;i<q;i++)
    {
        int oznaka;
        long long xi,yi;
        scanf("%d", &oznaka);
        if (oznaka==1)
        {
            double x1,x2;
            scanf("%lld%lld",&xi,&yi);
            x1=(2*xi+sqrt(4*xi*xi+4*(r*r-(h-yi)*(h-yi)-xi*xi)))/2;
            x2=(2*xi-sqrt(4*xi*xi+4*(r*r-(h-yi)*(h-yi)-xi*xi)))/2;
            double mini=min(x1,x2);
            double maxi=x1+x2-mini;
            if (mini<0) mini=0;
            if (maxi>w) maxi=w;
            for (long long j=ceil(mini);j<=maxi;j++)
            {
                double y1,y2;
                y1=(2*yi+sqrt( ( 4*yi*yi+ 4*( r*r- ( j-xi ) * ( j-xi )-yi*yi ) ) ) )/2;
                y2=(2*yi-sqrt( ( 4*yi*yi+ 4*( r*r- ( j-xi ) * ( j-xi )-yi*yi ) ) ) )/2;
                double miny=min(y1,y2);
                if (miny<0) miny=0;
                if (a[j]>miny) a[j]=miny;
            }
        }
        else if (oznaka==2)
        {
            scanf("%lld",&xi);
            printf("%lf\n",a[xi]);
        }
    }
}