#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
template <typename T, typename TT>
ostream& operator<<(ostream& s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  for (int(i) = 0; (i) < (((int)((t).size()))); ++(i)) s << t[i] << " ";
  return s;
}
int a, b, w, x, c, cma;
long long res = 0;
void sim() {
  if (cma == 0) {
    cout << res;
    exit(0);
  }
  ++res;
  if (b >= x) {
    b -= x;
    --cma;
    if (cma == 0) {
      cout << res;
      exit(0);
    }
  } else {
    b = w - (x - b);
  }
}
int main() {
  cin >> a >> b >> w >> x >> c;
  cma = c - a;
  if (cma <= 0) {
    pisz(0);
    return 0;
  }
  int najpierw = b / x;
  if (najpierw >= cma) {
    pisz(cma);
    return 0;
  }
  cma -= najpierw;
  res += najpierw;
  b %= x;
  set<int> bb;
  int theB = -1001001001;
  while (1) {
    sim();
    if (bb.count(b)) {
      theB = b;
      break;
    } else
      bb.insert(b);
  }
  int cma1 = cma;
  long long res1 = res;
  do {
    sim();
  } while (b != theB);
  int cmadelta = cma1 - cma;
  long long resdelta = res - res1;
  int tur = max(cma / cmadelta - 2, 0);
  res += resdelta * tur;
  cma -= cmadelta * tur;
  while (1) sim();
}
