// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



#define FOR(i,a,b) for(int i=(a);i<(b);i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(v) (v).begin(),(v).end()

#define fi first

#define se second



template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }

template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

typedef pair<int, pii> pip;



const ll INF = 1ll<<29;

const ll MOD = 1000000007;

const double EPS = 1e-5;



double dp[51][10001]; // i, sum+5000 = ?¢????

int X, Y, Z;

int V[4];

vector<pii> g[51];

pii event[51];



int main() {

	while (cin >> X >> Y >> Z, X || Y || Z) {

		REP(i, X) scanf("%d", V + i);

		

		fill(event, event + Y + 1, pii(0, 0));

		REP(i, Y + 1) g[i].clear();

		

		fill(dp[0], dp[Y + 1], 0);

		

		REP(i, Z) {

			int n, e, a;

			scanf("%d %d %d", &n, &e, &a);

			if (e == 1) {

				event[n] = pii(1, a);

			}

			else {

				if (e == 3) a = -a;

				event[n] = pii(2, a);

			}

		}

		

		REP(i, Y) {

			REP(j, X) {

				int p = min(i + V[j], Y);

				int c = 0;

				

				if (event[p].fi == 1) p = min(p + event[p].se, Y);

				else if (event[p].fi == 2) c = event[p].se;

				

				g[i].push_back(pii(p, c));

			}

		}

		

		dp[0][5000] = 1;

		REP(i, Y) {

			REP(j, 10001) {

				if (dp[i][j] == 0) continue;

				

				REP(k, g[i].size()) {

					int np = g[i][k].fi;

					int nc = max(j + g[i][k].se, 5000);

					

					dp[np][nc] += dp[i][j] / X;

				}

			}

		}

		

		double ans = 0;

		FOR(i, 5000, 10001) if (dp[Y][i] != 0)

			ans += (i - 5000) * dp[Y][i];

		ans += EPS;

		

		printf("%d\n", (int)ans);

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using namespace std;



#define FOR(i,a,b) for(int i=(a);i<(b);i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(v) (v).begin(),(v).end()

#define fi first

#define se second



template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }

template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

typedef pair<int, pii> pip;



const ll INF = 1ll<<29;

const ll MOD = 1000000007;

const double EPS = 1e-5;



double dp[51][5001]; // i, sum = ?¢????

int X, Y, Z;

int V[4];

vector<pii> g[51];

pii event[51];



int main() {

	while (cin >> X >> Y >> Z, X || Y || Z) {

		REP(i, X) scanf("%d", V + i);

		

		fill(event, event + Y + 1, pii(0, 0));

		REP(i, Y + 1) g[i].clear();

		

		fill(dp[0], dp[Y + 1], 0);

		

		REP(i, Z) {

			int n, e, a;

			scanf("%d %d %d", &n, &e, &a);

			if (e == 1) {

				event[n] = pii(1, a);

			}

			else {

				if (e == 3) a = -a;

				event[n] = pii(2, a);

			}

		}

		

		REP(i, Y) {

			REP(j, X) {

				int p = min(i + V[j], Y);

				int c = 0;

				

				if (event[p].fi == 1) p = min(p + event[p].se, Y);

				else if (event[p].fi == 2) c = event[p].se;

				

				g[i].push_back(pii(p, c));

			}

		}

		

		dp[0][0] = 1;

		REP(i, Y) {

			REP(j, 5001) {

				if (dp[i][j] == 0) continue;

				

				REP(k, g[i].size()) {

					int np = g[i][k].fi;

					int nc = max(j + g[i][k].se, 0);

					

					dp[np][nc] += dp[i][j] / X;

				}

			}

		}

		

		double ans = 0;

		REP(i, 5001) if (dp[Y][i] != 0)

			ans += i * dp[Y][i];

		ans += EPS;

		

		printf("%d\n", (int)ans);

	}

	return 0;

}

// Fastest known solution for this problem: