#include<stdio.h>
#include<math.h>
int main()
{
	int N,M,Ai,Xi,Yi,i,sr,uk;
	scanf("%d %d",&N,&M);
	
	for(i = 1; i <= N; i = i + 1)
	{
		scanf("%d",&Ai);
	}
	for(i = 1; i <= N; i = i + 1)
	{
		scanf("%d %d",&Xi,&Yi);
	}
	sr = abs(Ai*(Xi-Xi));
	uk = sr++;
	
printf("%d",uk);
	
	
	
}