#include <bits/stdc++.h> 
using namespace std;  
  
int main() 
{ 
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	int w, h, r, q, x, y, xi;
	bool exists = false;
	cin >> w >> h >> r >> q;
	long double res;
	
	pair<int, int> coord;
	
	while (q--) {
		cin >> x;
		
		if (x == 1) {
			cin >> x >> y;
			coord = make_pair(x, y);
			exists = true;
		} else {
			cin >> xi;
			if (!exists || xi <= coord.first - r || xi >= coord.first + r || coord.second - r >= h) {
				res = h;
			} else if (xi == coord.first && exists) {
				res = coord.second - r;
			} else {
				res = coord.second - sqrt(pow(r, 2) - pow(coord.first - xi, 2));
			}
			
			res = (res < 0) ? 0 : res;
			
			cout << fixed << setprecision(9) << res << "\n"; 
		}
	}
	
}