#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
  
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
  
using namespace std;
  
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
  
int main(){
	//freopen("test.txt", "r", stdin);
	int x, y, z;
	while(cin >> x >> y >> z, x|y|z){
		vector<int> dice(x);
		rep(i, x) cin >> dice[i];
		vector<P> ev(y+1, MP(0,0));
		rep(i, z){
			int n, e, a;
			cin >> n >> e >> a;
			ev[n] = MP(e, a);
		}

		vector<vector<double> > dp(y+1, vector<double>(z*100+1, 0.0));
		dp[0][0] = 1.0;

		for(int i = 0; i < y; i++){
			rep(j, x){
				int next = i+dice[j];
				int money = 0;
				if(next > y) next = y;
				switch(ev[next].first){
				case 1:
					next += ev[next].second;
					break;
				case 2:
					money += ev[next].second;
					break;
				case 3:
					money -= ev[next].second;
					break;
				default:
					break;
				}
				if(next > y) next = y;
				for(int k = 0; k <= min(z*100, z*100-money); k++){
					int m = k+money;
					if(m < 0) m = 0;
					dp[next][m] += dp[i][k]/x;
				}
			}
		}

		//cout << "***";
		double sum = 0;
		rep(i, z*100+1) sum += i*dp[y][i];
		cout << (int)sum << endl;
	}

 
    return 0;
}