#include <bits/stdc++.h>   const int N = 1e5 + 10;   const int MOD = 1e9 + 7;   const int INF = 2e9;   const long long INFLL = 1e18;   const double PI = acos((double)-1);   inline int mult(int a, int b, int p = MOD) { return (1ll * a * b) % p; }   inline int add(int a, int b, int p = MOD) { return (1ll * a + b) % p; }   inline int fpow(long long n, long long k, int p = MOD) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }   using namespace std;   int s, x1, x2, t1, t2, p, ok;   int f[10000][2];   bool d;   int main() {     ios::sync_with_stdio(false);     cin >> s >> x1 >> x2;     cin >> t1 >> t2;     cin >> p >> ok;     if (ok == -1)       d = 0;     else       d = 1;     int ans = abs(x2 - x1) * t2;     f[p][d] = 0;     if (d == 0) {       for (int i = p - 1; i >= 0; i--) f[i][d] = f[i + 1][d] + t1;       f[0][!d] = f[0][d];       d = !d;       for (int i = 1; i <= s; i++) f[i][d] = f[i - 1][d] + t1;       f[s][!d] = f[s][d];       d = !d;       for (int i = s - 1; i > p; i--) f[i][d] = f[i + 1][d] + t1;     } else {       for (int i = p + 1; i <= s; i++) f[i][d] = f[i - 1][d] + t1;       f[s][!d] = f[s][d];       d = !d;       for (int i = s - 1; i >= 0; i--) f[i][d] = f[i + 1][d] + t1;       f[0][!d] = f[0][d];       d = !d;       for (int i = 1; i < p; i++) f[i][d] = f[i - 1][d] + t1;     }     if (x1 > x2) {       for (int i = x2 + 1; i <= x1; i++) {         if (f[i][0] < (x1 - i) * t2) f[i][0] += s * 2 * t1;         int x = (i - x2) * t1 + f[i][0];         ans = min(ans, x);       }     } else {       for (int i = x2 - 1; i >= x1; i--) {         if (f[i][1] < (i - x1) * t2) f[i][1] += s * 2 * t1;         int x = (x2 - i) * t1 + f[i][1];         ans = min(ans, x);       }     }     cout << ans;     return 0;   }   