#include <bits/stdc++.h>   using namespace std;   const int N = 106;   long long d, A[N], f[N];   bool vs[N];   int X[N], Y[N], n;   queue<int> q;   inline long long dis(int a, int b) {     return abs(X[a] - X[b]) + abs(Y[a] - Y[b]);   }   bool judge(long long init) {     memset(f, -1, sizeof f);     while (!q.empty()) q.pop();     memset(vs, 0, sizeof vs);     q.push(1), f[1] = init, vs[1] = 1;     while (!q.empty()) {       int u = q.front();       q.pop(), vs[u] = 0;       for (int i = 1; i <= n; i++) {         if (dis(i, u) * d > f[u] || i == u) continue;         if (f[u] - dis(i, u) * d + A[i] > f[i]) {           f[i] = f[u] - dis(i, u) * d + A[i];           if (!vs[i]) q.push(i), vs[i] = 1;         }       }     }     if (f[n] == -1) return false;     return true;   }   int main() {     scanf( %d%I64d , &n, &d);     for (int i = 2; i < n; i++) scanf( %I64d , &A[i]);     for (int i = 1; i <= n; i++) scanf( %d%d , &X[i], &Y[i]);     long long L = 0, R = ((1LL) << 60);     while (L < R) {       long long mid = (L + R) >> 1;       if (judge(mid))         R = mid;       else         L = mid + 1;     }     if (!judge(L)) L++;     printf( %I64d n , L);     return 0;   }   