#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long double len[100005];
long double original[100005];

main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout << fixed;
cout << setprecision(12);
int w,h,r,n;
cin >> w >> h >> r >> n;

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

for (int i=0; i<n; i++)
{
    int ind; cin >> ind;
    if (ind==2)
    {
        int x; cin >> x;
        cout << len[x] << "\n";
    }
    if (ind==1)
    {
        int x,y;
        cin >> x >> y;
        if ((y-r)<h)
        {
          int k=0;
        for (int i=x+k; k<r; k++)
         {
           long double zezanje=sqrt(r*r-k*k)-(y-h);
            if (x+k<=w) if (original[x+k]-zezanje<len[x+k]) len[x+k]=original[x+k]-zezanje;
            if (x-k>=0) if (original[x-k]-zezanje<len[x-k]) len[x-k]=original[x-k]-zezanje;
            if (x-k<0 && x+k>w) break;
         }
        }
    }
}
}