#include <bits/stdc++.h>

using namespace std;

double s[100000];

int main()
{
    int w, h, r, n, b1, x, y;
    cin>>w>>h>>r>>n;

    for(int j = 0; j <= w; j++) s[j] = h;

    for(int i = 0; i < n; i++)
    {
        cin>>b1;
        if(b1 == 1)
        {
            cin>>x>>y;

            for(int j = 0; j <= w; j++)
            {
                if(x - j == r) s[j] = h;
                else s[j] = y - sqrt(r*r - (x - j)*(x - j));
            }
        }
        else
        {
            cin>>x;
            printf("%.12lf", s[x]);// cout<<s[x];
        }
    }

    return 0;
}