#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <map>

using namespace std;

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


class Cell{
public:
	int g;
	int a;
	Cell(){g=0;a=0;};
};

int main(){
	while(true){
		int rL,cL,ecL;
		cin >> rL >> cL >> ecL;			if(!rL&&!cL&&!ecL) return 0;
		
		int rS[rL];
		FOR(rI,0,rL) cin >> rS[rI];
		
		Cell cS[cL+1];
		FOR(ecI,0,ecL){
			int cI,g,a;
			cin >> cI >> g >> a;
			cS[cI].g = g;
			cS[cI].a = a;
		}

		double n2m2fp[cL+1][cL*100+1]; // ci==n no cell ni okane m dake motte saikoro de kuru kakuritsu
		double n2m2ep[cL+1][cL*100+1]; // ci==n no cell ni okane m dake motte tobasarete kuru kakuritsu
		FOR(n,0,cL+1) FOR(m,0,cL*100+1) {n2m2fp[n][m] = 0; n2m2ep[n][m] = 0;};
		n2m2fp[0][0]=1.0;

		FOR(n,0,cL){
			FOR(m,0,n*100+1){
				double fp = n2m2fp[n][m], ep=n2m2ep[n][m];
				Cell c = cS[n];
				//if((fp==0)&&(ep==0)) continue;
				//if((fp!=0)||(ep!=0)) cout<<"n:"<<n<<" m:"<<m<<" fp:"<<fp<<" ep:"<<ep<<endl;
				FOR(rI,0,rL){
					int r = rS[rI];
					n2m2fp[min(cL,n+r)][m] += ep / rL;
				}

				if(c.g==0){
					FOR(rI,0,rL){
						int r = rS[rI];
						n2m2fp[min(cL,n+r)][m] += fp / rL;
					}
				}
				if(c.g==1){
					n2m2ep[min(cL,n+c.a)][m] += fp;
				}
				if(c.g==2){
					FOR(rI,0,rL){
						int r = rS[rI];
						n2m2fp[min(cL,n+r)][m+c.a] += fp / rL;
					}
				}
				if(c.g==3){
					FOR(rI,0,rL){
						int r = rS[rI];
						n2m2fp[min(cL,n+r)][max(0,m-c.a)] += fp / rL;
					}
				}
			}
		}

		double res = 0.0;
		int n = cL;
		FOR(m,0,cL*100+1){
			double fp = n2m2fp[n][m], ep=n2m2ep[n][m];
			//if((fp!=0)||(ep!=0)) cout<<"n:"<<n<<" m:"<<m<<" fp:"<<fp<<" ep:"<<ep<<endl;
			res += m*(fp+ep);
		}
		cout << int(res) << endl;


	}


}