#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

#define rep1(i,x) for(ll i=1;i<=(x);++i)

ll imos[100002];
ll P[100002];
ll A[100002], B[100002], C[100002];

int main()
{
	ll N, M; scanf("%lld %lld", &N, &M);

	scanf("%lld", &P[0]);
	ll pre = P[0];

	rep1(i, M - 1) {
		scanf("%lld", &P[i]);
		if (pre < P[i]) {
			imos[pre]++; imos[P[i]]--;
		} else {
			imos[P[i]]++; imos[pre]--;
		}

		pre = P[i];
	}

	rep1(i, N - 1) scanf("%lld %lld %lld", &A[i], &B[i], &C[i]);

	ll ans = 0;

	rep1(i, N - 1) {
		imos[i] += imos[i - 1];
		ans += min(A[i] * imos[i], C[i] + B[i] * imos[i]);
	}

	printf("%lld\n", ans);
}