#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  double d, s, a, n, b, i, j, k, z, x = 0.0, y = 0.0, sum = 1e18, p, q, l, t, m;
  double xx, yy;
  double ans = 0;
  cin >> s >> x >> y;
  cin >> a >> b;
  cin >> p >> d;
  xx = x;
  if (a >= b)
    ans = abs(y - x) * b;
  else {
    if (y < x)
      z = -1;
    else
      z = 1;
    if (z == d) {
      if (z == 1) {
        if (x >= p) {
          xx = x;
          ans = (x - p) * a * b / (b - a);
          x = x + ans / b;
          ans = ans + max(y - x, 0.0) * a;
          ans = min(ans, ((y - xx) * b));
        } else {
          xx = x;
          ans = (s + s - p) * a;
          x = x + ans / b;
          p = 0.0;
          t = (x - p) * a * b / (b - a);
          x = x + t / b;
          ans = ans + max(y - x, 0.0) * a + t;
          ans = min(ans, ((y - xx) * b));
        }
      } else {
        if (x <= p) {
          ans = (p - x) * a * b / (b - a);
          x = x - ans / b;
          ans = ans + max(x - y, 0.0) * a;
          ans = min(ans, ((xx - y) * b));
        } else {
          xx = x;
          ans = (s + p) * a;
          x = x - ans / b;
          p = s;
          t = (p - x) * a * b / (b - a);
          x = x - t / b;
          ans = ans + max(x - y, 0.0) * a + t;
          ans = min(ans, ((xx - y) * b));
        }
      }
    } else {
      if (z == 1) {
        xx = x;
        ans = p * a;
        x = x + ans / b;
        p = 0.0;
        t = (x - p) * a * b / (b - a);
        x = x + t / b;
        ans = ans + max(y - x, 0.0) * a + t;
        ans = min(ans, ((y - xx) * b));
      } else {
        xx = x;
        ans = (s - p) * a;
        x = x - ans / b;
        p = s;
        t = (p - x) * a * b / (b - a);
        x = x - t / b;
        ans = ans + max(x - y, 0.0) * a + t;
        ans = min(ans, ((xx - y) * b));
      }
    }
  }
  cout << (long long int)ans;
  return 0;
}
