#include <cstdio>
using namespace std;

#define SIZE 100001
typedef long long Int;

Int min(Int a, Int b) {
	if (a > b) return b;
	return a;
}

int main() {
	int N, M, A[SIZE], B[SIZE], C[SIZE], P[SIZE];
	int D[SIZE];
	Int res = 0;
	int count = 0;

	scanf("%d%d", &N, &M);
	for (int i = 0;i < M;i++) {
		scanf("%d", &P[i]);
	}
	for (int i = 1;i < N;i++) {
		scanf("%d%d%d", &A[i], &B[i], &C[i]);
	}

	for (int i = 0;i <= N;i++) {
		D[i] = 0;
	}
	for (int i = 0;i + 1 < M;i++) {
		if (P[i] < P[i + 1]) {
			D[P[i]]++;
			if (P[i + 1] < N) {
				D[P[i + 1]]--;
			}
		}
		else {
			D[P[i + 1]]++;
			if (P[i] < N) {
				D[P[i]]--;
			}
		}
	}
	for (int i = 1;i < N;i++) {
		count += D[i];
		res += min((Int)A[i] * count, C[i] + (Int)B[i] * count);
	}

	printf("%lld\n", res);
	/*
	for (int i = 0;i < N;i++) {
		printf("%d ", D[i]);
	}
	*/

	return 0;
}