/*input
8 5
7 5 3 5 4
12 5 8
16 2 1
3 1 5
17 12 17
19 7 5
12 2 19
4 1 3
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int,int> > mv;
int times[100005];
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m,i,j,a,k=0,b,sum=0,A,B,C;
	cin>>n>>m;
	for(i=1;i<n;i++)
	{
		mv.push_back(make_pair(i,2));
	}
	cin>>a;
	for(i=1;i<m;i++)
	{
		cin>>b;
		if(a>b)
		{
			mv.push_back(make_pair(b,0));
			mv.push_back(make_pair(a,1));
		}
		else
		{
			mv.push_back(make_pair(a,0));
			mv.push_back(make_pair(b,1));
		}
		a=b;
	}
	sort(mv.begin(),mv.end());
	for(i=0;i<mv.size();i++)
	{
		/*cout<<mv[i].first<<" "<<mv[i].second<<"\n";*/
		if(mv[i].second==0) k++;
		if(mv[i].second==2) times[mv[i].first]=k;
		if(mv[i].second==1) k--;
	}
	for(i=1;i<n;i++)
	{
		cin>>A>>B>>C;
		sum+=min(C+B*times[i],A*times[i]);
		/*cout<<times[i]<<"\n";*/
	}
	cout<<sum << "\n";
	return 0;
}