func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1005;   vector<pair<int, int>> g[N], ans[N];   long long dist[N];   priority_queue<pair<int, int>> pq;   bool vis[N];   void dijkstra(int s) {     fill(dist, dist + N, 1LL << 61);     memset(vis, false, sizeof(vis));     dist[s] = 0;     pq.push({0, s});     while (!pq.empty()) {       int u = pq.top().second;       pq.pop();       if (vis[u]) continue;       vis[u] = true;       for (int i = 0; i < g[u].size(); i++) {         int v = g[u][i].first, w = g[u][i].second;         if (dist[v] > dist[u] + w) {           dist[v] = dist[u] + w;           pq.push({-dist[v], v});         }       }     }   }   int main() {     int n, m;     cin >> n >> m;     int x, y;     cin >> x >> y;     for (int i = 0; i < m; i++) {       int u, v, w;       cin >> u >> v >> w;       g[u].push_back({v, w});       g[v].push_back({u, w});     }     for (int i = 1; i <= n; i++) {       long long ti, ci;       cin >> ti >> ci;       dijkstra(i);       for (int j = 1; j <= n; j++) {         if (dist[j] <= ti) {           ans[i].push_back({j, ci});         }       }     }     for (int i = 1; i <= n; i++) {       g[i] = ans[i];     }     dijkstra(x);     if (dist[y] == 1LL << 61)       cout << -1;     else       cout << dist[y];     return 0;   }   