#include <bits/stdc++.h>   using namespace std;   const int MX = 1000;   int dp[MX][MX], a[MX], x[MX], y[MX], n, d;   int dis(int i, int j) { return abs(x[i] - x[j]) + abs(y[i] - y[j]); }   int main() {     cin >> n >> d;     for (int i = 2; i < n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) cin >> x[i] >> y[i];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) {         if (i != j) dp[i][j] = dis(i, j) * d - a[i];       }     for (int k = 1; k <= n; k++)       for (int i = 1; i <= n; i++)         for (int j = 1; j <= n; j++)           if (dp[i][j] > dp[i][k] + dp[k][j]) dp[i][j] = dp[i][k] + dp[k][j];     cout << dp[1][n] << endl;     return 0;   }   