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

double max(double a, double b)
{
    return ((a>b)?a:b);
}
double min(double a, double b)
{
    return ((a<b)?a:b);
}
double clamp(double x, double upper, double lower)
{
    return min(upper, max(x, lower));
}

int main()
{
    int w,h,r,q;
    
    int *grizovi;
    int grizNum = 0;
    
    int i,j;
    int x,y;
    
    double dH, dX, dY;
    double mer,rr;
    
    double xC,yC;
    double y1,y2;
    double disc;
    
    
    scanf("%d %d %d %d",&w,&h,&r,&q);
    
    dH = (double)h;
    
    rr = (double) (r*r);
    
    grizovi = (int*) calloc(q*2 - 2, sizeof(int));
    
    
    for(i=0;i<q;i++){
        scanf("%d",&j);
        
        //Grizi
        if(j==1){
            scanf("%d %d",&x,&y);
            
            grizovi[grizNum*2] = x;
            grizovi[grizNum*2+1] = y;
            grizNum++;
        }
        //Meri
        else{
            scanf("%d",&x);
            
            mer = (double) h;
            
            for(j=0;j<grizNum;j++){
                
                //xh = (long double) (x - grizovi[j*2]);
                xC = (double) (grizovi[j*2]);
                yC = (double) (grizovi[j*2+1]);
                
                //printf("xc:%f yc:%f\n",xC,yC);
                
                dX = (long double) x;
                
                /*
                (x-a)2 + (y-b)2 = r2
                x*x + y*y = r*r
                (y-b)2 = r*r - (x-a)2
                y = +-sqrt(r*r - x*x)
                */
                
                //da je centar Y = 0
                //yh1 = sqrt(rr - xh*xh);
                
                //(xt - xc)2 + ( -x-1/2 - yc)2 = r2
                //(xt - xc)2 + yc2 = r2
                
                //(x - xc)2 + (y - yc)2 = r*r
                // c + (-yc)*(-yc) = r*r
                // c + yc2 = r*r
                
                //x = x 
                // (x-xc)*(x-xc) + (y*y - yc*y - yc*y + yc*yc) = r*r
                // y2 -2yc*y + c = 0
                // y = y*y - 2*yc*y + ((x-xc)*(x-xc) -r*r +yc*yc)
                // y1 = ( -2*yc + sqrt( (-2*yc)*(-2*yc) - 4 * ((x-xc)*(x-xc) -r*r +yc*yc) ) ) / 2
                // y2 = ( -2*yc - sqrt( (-2*yc)*(-2*yc) - 4 * ((x-xc)*(x-xc) -r*r +yc*yc) ) ) / 2
                
                disc = sqrt( (-2.0*yC)*(-2.0*yC) - 4.0 * ((dX-xC)*(dX-xC) -rr +yC*yC) );
                
                y1 = ( 2.0*yC + disc ) / 2.0;
                y2 = ( 2.0*yC - disc ) / 2.0;
                
                //printf("disc:%f\n",disc);
                
                //printf("%f %f\n",y1,y2);
                
                dY = min(y1,y2);
                
                mer -= clamp(dH-dY,dH,0.0);
                mer = clamp(mer,dH,0.0);
                
                //Y osa u ili van kruga u tacki X?
                
            }
            
            printf("%f\n",mer);
        }
        
        //scanf("%d",&knjige[i]);
        //printf("%d ",knjige[i]);
    }
    
    return 0;
}