#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

double dp[51][5001];//マス目、所持金
int main(void)
{
	int x, y, z;
	vector<int> xmass;
	map<int, P> evemass; 
	while(cin >> x >> y >> z && x && y)
	{
		memset(dp, 0, sizeof(dp));
		xmass.resize(x);
		for (int i = 0; i < x; i++)
		{
			cin >> xmass[i];
		}
		evemass.clear();
		for (int i = 0; i < z; i++)
		{
			int n, e, a;
			cin >> n >> e >> a;
			evemass[n] = P(e, e == 3 ? -a: a);
		}
		dp[0][0] = 1;
		for (int i = 0; i < y; i++)//マス目
		{
			for (int j = 0; j <= 5000; j++)//所持金
			{
				for (int k = 0; k < x; k++)//出たマスの種類
				{
					int ni = min(i + xmass[k], y), nj = j;
					if(evemass.count(ni))
					{
						if(evemass[ni].first == 1)
							ni = min(ni + evemass[ni].second, y);
						else nj = max(0, j + evemass[ni].second);
					}
					if(dp[i][j])
						dp[ni][nj] += dp[i][j] / x;
				}
			}
		}
		double ans = 0;
		for (int i = 0; i <= 5000; i++)
		{
			ans += dp[y][i] * i;
		}
		cout << (int)ans << endl;
	}
	return 0;
}