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


int x;//????????¬?????????????????°
int y;//???????????°
int z;//???????????????????????°
int v[4];//????????¬?????????????????????????????°
pair<int, int> n[51];//??????????????????(first:?¨???? second:??? ?????????:????????????)
double dp[51][6000] = { { 1 } };


void solve(){
	for (int i = 0; i < y; i++){
		for (int j = 0; j < 6000; j++){
			if (dp[i][j] == 0) continue;
			for (int k = 0; k < x; k++){
				int event = n[min(y, i + v[k])].first;
				int value = n[min(y, i + v[k])].second;
				if (event == 0){
					dp[min(y, i + v[k])][j] += dp[i][j] / x;
				}
				if (event == 1){
					dp[min(y, i + v[k] + value)][j] += dp[i][j] / x;
				}
				if (event == 2){
					dp[min(y, i + v[k])][j + value] += dp[i][j] / x;
				}
				if (event == 3){
					dp[min(y, i + v[k])][max(0, j - value)] += dp[i][j] / x;
				}
			}
		}
	}
}


void clear(){
	for (int i = 0; i < 51; i++){
		n[i] = { 0, 0 };
	}
	for (int i = 0; i < 51; i++){
		for (int j = 0; j < 6000; j++){
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 1;
}


int main(){
	while(cin >> x >> y >> z, x + y + z){
		for (int i = 0; i < x; i++) cin >> v[i];
		for (int i = 0; i < z; i++){
			int trout, kind, value;
			cin >> trout >> kind >> value;
			n[trout] = { kind, value };
		}

		solve();

		double ans = 0;
		for (int i = 0; i < 6000; i++){
			ans += dp[y][i] * i;
		}

		cout << (int)ans << endl;

		clear();
	}

	return 0;
}