#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 100;
const double eps = 1e-4;
const double mod = 1e9 + 7;
int main() {
  int n, k, p, d, s, x1, x2, t1, t2, ans, t, x;
  cin >> s >> x1 >> x2 >> t1 >> t2 >> p >> d;
  int dis = abs(x1 - x2);
  if (t1 >= t2) {
    cout << dis * t2;
    return 0;
  }
  int dist;
  if (x1 < x2)
    if (d == 1)
      dist = (x1 - p + 2 * s) % (2 * s);
    else
      dist = (x1 + p);
  else if (d == -1)
    dist = (p - x1 + 2 * s) % (2 * s);
  else
    dist = (s - p + s - x1);
  dist += dis;
  cout << min(dist * t1, dis * t2) << endl;
}
