#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
      long long n,m,r,l;
      long long ans=0;
      long long a[100000];
      long long b[100000];
      long long c[100000];
      long long cnt[100001];
      long long p[100000];
      cin>>n>>m;
      REP(i,100001)cnt[i]=0;
      REP(i,m){
            cin>>p[i];p[i]--;
            if(i==0)continue;
            r=p[i-1];l=p[i];
            if(r>l)swap(r,l);
            cnt[r]++;
            cnt[l]--;
      }
      REP(i,n)cnt[i+1]+=cnt[i];
      REP(i,n-1){
            cin>>a[i]>>b[i]>>c[i];
            if(a[i]*cnt[i]>b[i]*cnt[i]+c[i])ans+=b[i]*cnt[i]+c[i];
            else ans+=a[i]*cnt[i];
      }
      printf("%lld\n",ans);
}