func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double eps = 1e-9;   const int MAXN = 1010;   const int EN = MAXN * MAXN;   int n, m, D;   int a[MAXN], size, head[MAXN];   struct Node {     int x, y;   } arr[MAXN];   struct Edge {     int v, w, next;   } E[EN];   void init() {     size = 0;     memset(head, -1, sizeof(head));   }   void addEdge(int u, int v, int w) {     E[size].w = w;     E[size].v = v;     E[size].next = head[u];     head[u] = size++;   }   inline int dist(const Node& a, const Node& b) {     return abs(a.x - b.x) + abs(a.y - b.y);   }   int d[MAXN];   int dij(int src) {     memset(d, INF, sizeof(d));     d[src] = 0;     priority_queue<pair<int, int> > que;     que.push(make_pair(0, src));     while (!que.empty()) {       pair<int, int> x = que.top();       que.pop();       int u = x.second;       if (d[u] != x.first) continue;       for (int e = head[u]; e != -1; e = E[e].next) {         int v = E[e].v;         int w = d[u] + E[e].w - a[u];         if (w < d[v]) {           d[v] = w;           que.push(make_pair(d[v], v));         }       }     }     return d[n - 1];   }   int main() {     a[0] = 0;     while (~scanf( %d%d , &n, &D)) {       init();       a[n - 1] = 0;       for (int i = 1; i < n - 1; ++i) scanf( %d , &a[i]);       for (int i = 0; i < n; ++i) scanf( %d%d , &arr[i].x, &arr[i].y);       for (int i = 0; i < n; ++i) {         for (int j = i + 1; j < n; ++j) {           int dis = dist(arr[i], arr[j]);           addEdge(i, j, dis * D);           addEdge(j, i, dis * D);         }       }       printf( %d n , dij(0));     }     return 0;   }   