func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie();     cout.tie();     int s, x1, x2;     cin >> s >> x1 >> x2;     int t1, t2;     cin >> t1 >> t2;     int p, d;     cin >> p >> d;     int ans = abs(x1 - x2) * t2;     if (x1 < x2) {       if (p <= x1) {         if (d == 1) {           ans = min(ans, abs(x1 - p) * t1 + abs(x2 - x1) * t1);         } else {           ans = min(ans, abs(x2) * t1 + abs(p) * t1);         }       } else if (p >= x1 && p <= x2) {         if (d == 1) {           ans = min(ans, abs(s - p) * t1 + abs(x1 - s) * t1 + abs(x1) * t1 +                              abs(x2) * t1);         } else {           ans = min(ans, abs(p - x1) * t1 + abs(x1) * t1 + abs(x2) * t1);         }       } else {         if (d == 1) {           ans = min(ans, abs(s - p) * t1 + abs(s - x1) * t1 + abs(x1) * t1 +                              abs(x2) * t1);         } else {           ans = min(ans, abs(p - x1) * t1 + abs(x1) * t1 + abs(x2) * t1);         }       }     } else {       if (p <= x2) {         if (d == 1) {           ans = min(ans, abs(x1 - p) * t1 + abs(x1 - s) * t1 + abs(x2 - s) * t1);         } else {           ans = min(ans, abs(p) * t1 + abs(x1) * t1 + abs(s - x1) * t1 +                              abs(x2 - s) * t1);         }       } else if (p >= x1) {         if (d == 1) {           ans = min(ans, abs(p - s) * t1 + abs(s - x1) * t1 + abs(x2 - x1) * t1);         } else {           ans = min(ans, abs(x1 - p) * t1 + abs(x2 - x1) * t1);         }       } else {         if (d == 1) {           ans = min(ans, abs(x1 - p) * t1 + abs(x1 - s) * t1 + abs(s - x2) * t1);         } else {           ans = min(ans, abs(p) * t1 + abs(x1) * t1 + abs(x1 - s) * t1 +                              abs(s - x2) * t1);         }       }     }     cout << ans;   }   