#include <iostream>
#include <map>

#define MAX_X 4
#define MAX_Y 50
#define MAX_N 50

using namespace std;
typedef pair<int,int> event;

int main(){
	int X,Y,Z;
	cin >> X >> Y >> Z;
	while(X){
		int V[MAX_X];
		for(int i = 0; i < X; ++i){
			cin >> V[i];
		}
		map<int,event> ev;
		for(int i = 0; i < Z; ++i){
			int n, e, a;
			cin >> n >> e >> a;
			ev[n] = event(e,a);
		}
		//i番目のマスでj円持っている確率
		double p[MAX_N+1][100*MAX_N] = {0};
		p[0][0] = 1;
		for(int i = 0; i < Y; ++i){
			for(int j = 0; j < 100*MAX_N; ++j){
				if(p[i][j]){
					for(int k = 0; k < X; ++k){
						if(ev.find(i+V[k]) == ev.end()){
							p[min(i+V[k],Y)][j] += p[i][j]/X;
						}else{
							switch(ev[i+V[k]].first){
								case 1:
									p[min(i+V[k]+ev[i+V[k]].second,Y)][j] += p[i][j]/X;
									break;
								case 2:
									p[i+V[k]][j+ev[i+V[k]].second] += p[i][j]/X;
									break;
								case 3:
									p[i+V[k]][max(0, j-ev[i+V[k]].second)] += p[i][j]/X;
									break;
							}
						}
					}
				}
			}
		}
		double E = 0;
		for(int i = 0; i < 100*MAX_N; ++i){
			E += p[Y][i]*i;
		}
		cout << (int)E << endl;
		cin >> X >> Y >> Z;
	}
}