#include <bits/stdc++.h>   const long long int mrx = 1e6 + 5, M = 1e9 + 7;   long long int mx = INT_MIN, mn = INT_MAX;   using namespace std;   long long int x1, x2, s, t1, t2, p, d;   long long int poezd, igor;   int main() {     ios_base::sync_with_stdio(NULL);     cin.tie(NULL);     cin >> s >> x1 >> x2;     cin >> t1 >> t2;     cin >> p >> d;     if (t2 <= t1) {       cout << abs(x1 - x2) * t2;       return 0;     } else {       if (d == 1) {         if (x1 < x2) {           if (p == x1) {             cout << (x2 - x1) * t1;           } else if (p < x1) {             cout << min((x2 - x1) * t2, (x2 - p) * t1);           } else {             cout << min((x2 - x1) * t2, (s - p) * t1 + s * t1 + x2 * t1);           }         } else {           cout << min((x1 - x2) * t2, (s - p) * t1 + (s - x2) * t1);         }       }       if (d == -1) {         if (x1 < x2) {           cout << min((x2 - x1) * t2, p * t1 + x2 * t1);         } else {           if (p == x1) {             cout << (x1 - x2) * t1;           } else if (p < x1) {             cout << min((x1 - x2) * t2, p * t1 + s * t1 + (s - x2) * t1);           } else {             cout << min((x1 - x2) * t2, (p - x2) * t1);           }         }       }     }     return 0;   }   