func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > ke[105];   int d[105], x[105], y[105], a[105];   int n, m, s, t, module;   void dijkstra() {     set<pair<int, int> > q;     for (int u = 1; u <= n; ++u) d[u] = 1000000007;     d[1] = 0;     q.insert(make_pair(d[1], 1));     while (!q.empty()) {       pair<int, int> top = *(q.begin());       q.erase(top);       int u = top.second;       if (u == n) return;       for (int i = 0; i < ke[u].size(); ++i) {         int v = ke[u][i].first;         int w = ke[u][i].second;         if (d[v] > d[u] + w) {           q.erase(make_pair(d[v], v));           d[v] = d[u] + w;           q.insert(make_pair(d[v], v));         }       }     }   }   int main() {     cin >> n >> module;     for (int i = 2; i <= n - 1; ++i) scanf( %d , &a[i]);     for (int i = 1; i <= n; ++i) scanf( %d%d , &x[i], &y[i]);     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) {         if (i != j) {           ke[i].push_back(make_pair(               j, module * (abs(x[i] - x[j]) + abs(y[i] - y[j])) - a[j]));           ke[j].push_back(make_pair(               i, module * (abs(x[i] - x[j]) + abs(y[i] - y[j])) - a[i]));         } else {           ke[i].push_back(make_pair(j, 1000000007));           ke[j].push_back(make_pair(i, 1000000007));         }       }     }     s = 1;     t = n;     dijkstra();     if (d[t] == 1000000007)       printf( -1 );     else       printf( %d n , d[t]);     return 0;   }   