#include <bits/stdc++.h>
int IntMaxVal = (int)1e20;
int IntMinVal = (int)-1e20;
long long LongMaxVal = (long long)1e20;
long long LongMinVal = (long long)-1e20;
template <typename T>
inline void minimize(T& a, T b) {
  a = std::min(a, b);
}
template <typename T>
inline void maximize(T& a, T b) {
  a = std::max(a, b);
}
using namespace std;
template <typename T>
struct argument_type;
template <typename T, typename U>
struct argument_type<T(U)> {};
template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& s) {
  is >> s.first >> s.second;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (int i = 0; i < v.size(); i++) os << v[i] << ' ';
  os << '\n';
  ;
  return os;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& s, pair<T1, T2>& t) {
  s << t.first << ' ' << t.second;
  return s;
}
template <typename T>
vector<T> readVector(int n) {
  vector<T> res(n);
  for (int i = 0; i < n; i++) cin >> res[i];
  return res;
}
class step {
 public:
  long long time;
  int destB;
};
const int MAXB = 1000;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a;
  cin >> a;
  ;
  long long b;
  cin >> b;
  ;
  long long w;
  cin >> w;
  ;
  long long x;
  cin >> x;
  ;
  long long c;
  cin >> c;
  ;
  long long d = c - a;
  vector<vector<step>> steps(1);
  steps[0].resize(MAXB);
  for (int b = x; b < MAXB; ++b) {
    steps[0][b].time = 1;
    steps[0][b].destB = b - x;
  }
  for (int b = x - 1; b >= 0; --b) {
    steps[0][b].time = 1 + steps[0][w - x + b].time;
    steps[0][b].destB = steps[0][w - x + b].destB;
  }
  while ((1LL << (steps.size() - 1)) < d) {
    steps.resize(steps.size() + 1);
    steps.back().resize(MAXB);
    int prev = steps.size() - 2;
    for (int b = 0; b < MAXB; ++b) {
      int dest = steps[prev][b].destB;
      steps.back()[b].destB = steps[prev][dest].destB;
      steps.back()[b].time = steps[prev][b].time + steps[prev][dest].time;
    }
  }
  long long time = 0;
  for (int i = steps.size() - 1; i >= 0; --i) {
    if (d >= (1LL << i)) {
      d -= (1LL << i);
      time += steps[i][b].time;
      b = steps[i][b].destB;
    }
  }
  cout << time;
}
