#include<bits/stdc++.h>
using namespace std;
long long int A[100010],B[100010],IC[100010],n,m,p,judge[100010],ans,ss;

int main(){
    cin >> n >> m;
    cin >> ss;
    for(int i=1;i<m;i++){
        cin >> p;
        judge[min(ss,p)]++;
        judge[max(ss,p)]--;
        ss=p;
    }
      //for(int i=1;i<m;i++)cout << judge[i] << endl;

    ss=0;
    for(int i=1;i<n;i++)cin >> A[i] >> B[i] >> IC[i];

    for(int i=1;i<n;i++){
        ss+=judge[i];
        ans+=min(ss*A[i],IC[i]+B[i]*ss);
      //  printf("ans=%d\n",ans);
    }
    cout << ans << endl;

return 0;
}