func_code_string: #include <bits/stdc++.h>   using namespace std;   int dis[10001][1001];   int pos[10001];   int g, r, n, m;   void bfs() {     deque<pair<int, pair<int, int> > > fila;     fila.push_front({0, {0, 0}});     while (!fila.empty()) {       int v = fila.front().first;       int s = fila.front().second.first;       int t = fila.front().second.second;       fila.pop_front();       if (dis[v][s] != -1) continue;       dis[v][s] = t;       if (v) {         if (s < g and s + (pos[v] - pos[v - 1]) <= g and             dis[v - 1][s + (pos[v] - pos[v - 1])] == -1) {           fila.push_front({v - 1, {s + (pos[v] - pos[v - 1]), t}});         }       }       if (v < m - 1) {         if (s < g and s + (pos[v + 1] - pos[v]) <= g and             dis[v + 1][s + (pos[v + 1] - pos[v])] == -1) {           fila.push_front({v + 1, {s + (pos[v + 1] - pos[v]), t}});         }       }       if (s == g and dis[v][0] == -1) {         fila.push_back({v, {0, t + 1}});       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     memset(dis, -1, sizeof(dis));     cin >> n >> m;     int l[m];     for (int i = 0; i < m; i++) cin >> l[i];     sort(l, l + m);     for (int i = 0; i < m; i++) pos[i] = l[i];     cin >> g >> r;     bfs();     int res = -1;     for (int i = 0; i < m - 1; i++) {       if (dis[i][0] == -1) continue;       if ((pos[m - 1] - pos[i]) > g) continue;       int atual = dis[i][0] * (g + r) + (pos[m - 1] - pos[i]);       if (res == -1)         res = atual;       else         res = min(res, atual);     }     cout << res << endl;   }   