#include <bits/stdc++.h>   using namespace std;   int main() {     int s, x1, x2;     cin >> s >> x1 >> x2;     int t1, t2;     cin >> t1 >> t2;     int time_for_igor = abs(x1 - x2) * t2;     int p, d;     cin >> p >> d;     int time_for_tram = -1;     if (x2 > x1) {       if (d == 1) {         if (p > x1) {           time_for_tram = s - p;           time_for_tram += s;           time_for_tram += x1;           time_for_tram += (x2 - x1);           time_for_tram *= t1;         } else {           time_for_tram = abs(x1 - p) * t1;           time_for_tram += abs(x1 - x2) * t1;         }       } else {         time_for_tram = p;         time_for_tram += x1;         time_for_tram += (x2 - x1);         time_for_tram *= t1;       }     } else {       if (d == -1) {         if (p < x1) {           time_for_tram = p;           time_for_tram += s;           time_for_tram += (s - x1);           time_for_tram += (x1 - x2);           time_for_tram *= t1;         } else {           time_for_tram = p - x1;           time_for_tram += x1 - x2;           time_for_tram *= t1;         }       } else {         time_for_tram = s - p;         time_for_tram += s - x1;         time_for_tram += x1 - x2;         time_for_tram *= t1;       }     }     cout << min(time_for_tram, time_for_igor) << endl;   }   