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

int main(){
  double pb[100][5001];
  int x,y,z,n,m,l,ub;
  int v[4],e[51],a[51];

  while(cin >> x >> y >> z && (x||y||z)){

    for(int i=0;i<x;i++)cin >> v[i];
    for(int i=0;i<=y;i++)e[i] = a[i] = 0;
    ub = 0;
    for(int i=0;i<z;i++){
      cin >> n >> m >> l;
      e[n] = m; a[n] = l;
      if(m==2)ub += a[n];
    }

    for(int i=0;i<=y;i++)
      for(int j=0;j<=ub;j++)pb[i][j] = 0.0;
    pb[0][0] = 1.0;

    for(int i=0;i<y;i++)
      for(int j=0;j<=ub;j++){
	if(pb[i][j] == 0.0)continue;
	for(int k=0;k<x;k++){
	  int next = min(y,i+v[k]),value = j;
	  if(e[next] == 1)next = min(y,next+a[next]);
	  else if(e[next] == 2)value = j + a[next];
	  else if(e[next] == 3)value = max(0,j-a[next]);
	  pb[next][value] += pb[i][j]/x;
	}
      }
    

    double ans = 0.0;
    for(int i=0;i<=ub;i++)ans += pb[y][i] * i;
    cout << (int)(ans) << endl;
  }
}