func_code_string: #include <bits/stdc++.h>   using namespace std;   long long g, r;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n, m;     cin >> n >> m;     vector<int> d;     for (int i = 0; i < m; i++) {       long long dt;       cin >> dt;       d.push_back(dt);     }     sort(d.begin(), d.end());     cin >> g >> r;     vector<vector<bool>> vis(m, vector<bool>(g + 1));     vector<vector<int>> dis(m, vector<int>(g + 1, 0));     deque<tuple<int, int>> dq;     dq.push_back(make_tuple(0, 0));     long long ans = 1e9;     vis[0][0] = 1;     while (!dq.empty()) {       int i, t;       tie(i, t) = dq.front();       dq.pop_front();       if (t == 0) {         int ttn = n - d[i];         if (ttn <= g) {           ans = min(ans, dis[i][t] * (r + g) + ttn);         }       }       if (t == g) {         if (!vis[i][0]) {           dq.push_back(make_tuple(i, 0));           dis[i][0] = dis[i][t] + 1;           vis[i][0] = 1;         }         continue;       }       if (i) {         int rs = t + d[i] - d[i - 1];         if (rs <= g && !vis[i - 1][rs]) {           dis[i - 1][rs] = dis[i][t];           dq.push_front(make_tuple(i - 1, rs));           vis[i - 1][rs] = 1;         }       }       if (i < m - 1) {         int rs = t + d[i + 1] - d[i];         if (rs <= g && !vis[i + 1][rs]) {           dis[i + 1][rs] = dis[i][t];           dq.push_front(make_tuple(i + 1, rs));           vis[i + 1][rs] = 1;         }       }     }     if (ans == 1e9) {       cout << -1 <<   n ;     } else {       cout << ans <<   n ;     }   }   