#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;


typedef struct E_TAG{
    int type;
    int value;
} M;


int main(){
    while(true){
    int x,y,z;
    cin >> x >> y >> z;
    if(x==0&&y==0&&z==0) return 0;
    vector<vector<double> > DP(y+1,vector<double>(5001,0));
    vector<M> V;
    vector<int> R;

    for(int i=0;i<x;i++){
        int temp;
        cin >> temp;
        R.push_back(temp);
    }
    for(int i=0;i<y+1;i++){
        V.push_back({0,0});
    }
    for(int i=0;i<z;i++){
        int n,e,a;
        cin >> n >> e >> a;
        V[n] = {e,a};
    }
    DP[0][0] = 1.0;
    for(int i=0;i<V.size()-1;i++){
        for(int j=0;j<5001;j++){
            if(DP[i][j] == 0) continue;
            for(int z=0;z<R.size();z++){
                int nex = min(y,i+R[z]);
                int now = j;
                if(V[nex].type == 1) nex += V[nex].value;
                else if(V[nex].type == 2) now += V[nex].value;
                else if(V[nex].type == 3) now -= V[nex].value;
                if(now < 0) now = 0;
                if(nex > y) nex = y;
                DP[nex][now] += (DP[i][j] / R.size());
            }
        }
    }
    double out = 0;
    for(int i=0;i<5001;i++){
        out += i * DP[y][i];
    }
    cout << (int)out << endl;
    }
}