#include<bits/stdc++.h>
#define maxh 100010
using namespace std;

int w, r, h, q;
double a[maxh];
const double h1 = 0.267949192431;

void dec(int x, int y){
	a[x] -= y;
	if(x){
		a[x-1] -= y;
		a[x-1] += h1;
	}
	if(x < w){
		a[x+1] -= y;
		a[x+1] += h1;
	}	
}

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> w >> h >> r >> q;
	for(int i = 0; i < w; ++i){
		a[i] = h;
	}
	for(int i = 0; i < q; ++i){
		int x, y, tmp;
		cin >> tmp;
		if(tmp == 2){
			cin >> y;
			cout << setprecison(9) << fixed << a[y] << '\n';
			continue;
		}
		cin >> x >> y;
		if(y == h+r){
			continue;
		}
		if(r == 1){
			a[x]--;
		}
		if(r == 2){
			if(y == h){
				dec(x, 2);
			} else {
				dec(x, 1);
			}
		}
	}
}