#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, w, x, c;
  cin >> a >> b >> w >> x >> c;
  long long d = c - a;
  long long t = 0;
  long long b_inc = w - x;
  if (b >= x) {
    long long step = b / x;
    step = min(step, d);
    d -= step;
    b %= x;
    t += step;
    if (d == 0) {
      cout << t;
      return 0;
    }
    step = (x - b - 1) / b_inc + 1;
    b += step * b_inc;
    t += step;
  }
  vector<int> dec(2 * w, 0);
  for (int i = 0; i < 2 * w; ++i) {
    if (dec[b] == 0) {
      long long step = b / x;
      step = min(step, d);
      d -= step;
      dec[b] = step;
      b %= x;
      t += step;
      if (d == 0) {
        cout << t;
        return 0;
      }
      step = (x - b - 1) / b_inc + 1;
      b += step * b_inc;
      t += step;
    } else {
      long long loop_dec = 0;
      long long loop_time = 0;
      long long b_start = b;
      long long step = b / x;
      loop_dec += step;
      loop_time += step;
      b %= x;
      step = (x - b - 1) / b_inc + 1;
      b += step * b_inc;
      loop_time += step;
      while (b != b_start) {
        long long step = b / x;
        loop_dec += step;
        loop_time += step;
        b %= x;
        step = (x - b - 1) / b_inc + 1;
        b += step * b_inc;
        loop_time += step;
      }
      if (d > loop_dec) {
        long long n_loops = d / loop_dec;
        if (d % loop_dec == 0) {
          --n_loops;
        }
        d -= loop_dec * n_loops;
        t += n_loops * loop_time;
        b = b_start;
        break;
      }
    }
  }
  while (d > 0) {
    long long step = b / x;
    step = min(step, d);
    d -= step;
    dec[b] = step;
    b %= x;
    t += step;
    if (d == 0) {
      cout << t;
      return 0;
    }
    step = (x - b - 1) / b_inc + 1;
    b += step * b_inc;
    t += step;
  }
  cout << t;
  return 0;
}
