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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

int x, y, z;
int v[4];
int e[60], a[60];

double dp[60][10010];
double calc(int p, int q)
{
	if (p >= y) return q;
	if (dp[p][q] != -1) return dp[p][q];
	double s = 0;
	rep(i, x){
		int np = p + v[i];
		int nq = q;
		if (e[np] == 1) np += a[np];
		else if (e[np] == 2) nq += a[np];
		else if (e[np] == 3) nq = max(0, nq - a[np]);
		s += calc(np, nq) / x;
	}
	return dp[p][q] = s;
}

int main()
{
	while (cin >> x >> y >> z, x){
		memset(e, 0, sizeof(e));
		rep(i, x) cin >> v[i];
		rep(i, z){
			int ni, ei, ai;
			cin >> ni >> ei >> ai;
			e[ni] = ei;
			a[ni] = ai;
		}
		fill_n(*dp, 60 * 10010, -1);
		cout << (int)calc(0, 0) << endl;
	}
}