#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int x, y, z;
        cin >> x >> y >> z;
        if(x == 0)
            return 0;

        vector<int> roulette(x);
        for(int i=0; i<x; ++i)
            cin >> roulette[i];

        int maxMoney = 0;
        vector<pair<int, int> > masu(y+1, make_pair(-1, -1));
        for(int i=0; i<z; ++i){
            int n, e, a;
            cin >> n >> e >> a;
            masu[n] = make_pair(e, a);
            if(e == 2)
                maxMoney += a;
        }

        vector<vector<double> > prob(y+1, vector<double>(maxMoney+1, 0.0));
        prob[0][0] = 1.0;
        for(int i=0; i<y; ++i){
            for(int j=0; j<x; ++j){
                int to = min(y, i + roulette[j]);
                int get = 0;
                if(masu[to].first == 1)
                    to = min(y, to + masu[to].second);
                else if(masu[to].first == 2)
                    get = masu[to].second;
                else if(masu[to].first == 3)
                    get = -masu[to].second;
                for(int k=0; k<=maxMoney; ++k){
                    int money = min(maxMoney, max(0, k+get));
                    prob[to][money] += prob[i][k] / x;
                }
            }
        }

        double ret = 0.0;
        for(int i=0; i<=maxMoney; ++i)
            ret += i * prob[y][i];
        cout << (int)ret << endl;
    }
}