func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, d;     cin >> n >> d;     int in[n];     vector<pair<int, int>> c;     in[0] = in[n - 1] = 0;     for (int i = 1; i < n - 1; i++) cin >> in[i];     for (int i = 0; i < n; i++) {       int x, y;       cin >> x >> y;       c.push_back({x, y});     }     long long dis[n][n];     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         dis[i][j] =             d * (abs(c[i].first - c[j].first) + abs(c[i].second - c[j].second));         if (i != 0 && i != n - 1 && i != j) dis[i][j] -= in[i];       }     }     for (int k = 0; k < n; k++) {       for (int i = 0; i < n; i++) {         for (int j = 0; j < n; j++) {           if (dis[i][k] + dis[k][j] < dis[i][j])             dis[i][j] = dis[i][k] + dis[k][j];         }       }     }     cout << dis[0][n - 1] << endl;   }   