#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int vn, g, en;
	while(cin >> vn >> g >> en, vn) {
		int v[4], e[51] = { 0 }, a[51];

		for(int i = 0; i < vn; i++) {
			cin >> v[i];
		}
		for(int i = 0; i < en; i++) {
			int n;
			cin >> n;
			cin >> e[n] >> a[n];
		}

		double dp[51][5010] = { 0 };
		dp[0][0] = 1.0;

		for(int i = 0; i < g; i++) {
			for(int j = 0; j <= 5000; j++) {
				if(dp[i][j] == 0) continue;

				for(int k = 0; k < vn; k++) {
					int ni = min(i + v[k], g), nj = j;
					if(e[ni] == 1) {
						ni = min(ni + a[ni], g);
					}
					else if(e[ni] == 2) {
						nj += a[ni];
					}
					else if(e[ni] == 3) {
						nj = max(nj - a[ni], 0);
					}
					dp[ni][nj] += dp[i][j] / vn;
				}
			}
		}
		double ans = 0;
		for(int j = 0; j <= 5000; j++) {
			ans += j * dp[g][j];
		}
		cout << int(ans) << endl;
	}
}