#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;

double visina[100000];

int main()
{
    int w,h,q,r,i,izbor,x,y,j;

    scanf("%d%d%d%d",&w,&h,&r,&q);

    for(i=0; i<w; i++)
        visina[i]=h;

    for(i=0; i<q; i++)
    {
        scanf("%d%d",&izbor,&x);
        if(izbor==1)
        {
            scanf("%d",&y);

            for(j=x-r; j<x+r; j++)
            {
                if(visina[j]>(double)((double)y-sqrt((r*r)-(x-j)*(x-j))))
                    visina[j]=(double)((double)y-sqrt((r*r)-(x-j)*(x-j)));
                if((double)((double)y-sqrt((r*r)-(x-j)*(x-j))<=0))
                    visina[j]=0;
            }
        }
        else
            printf("%lf\n", visina[x]);
    }

    return 0;
}