#include <bits/stdc++.h>
using namespace std;
long long k[1010];
int main() {
  long long a, b, w, x, c;
  cin >> a >> b >> w >> x >> c;
  if (c <= a) {
    cout << 0;
    return 0;
  }
  long long d = b;
  long long op = 0;
  long long con = 0;
  while (k[d] == 0) {
    if (d >= x) {
      k[d] = 1;
      d = d - x;
    } else {
      k[d] = 2;
      d = w - (x - d);
      con++;
    }
    op++;
  }
  long long dif = c - a;
  long long res = dif / (op - con);
  if (res * (op - con) < dif) res++;
  a = a - (con * (res - 1));
  c = c - (op * (res - 1));
  res = ((res - 1) * op);
  while (c > a) {
    c--;
    if (b >= x)
      b = b - x;
    else {
      b = w - (x - b);
      a--;
    }
    res++;
  }
  cout << res;
  return 0;
}
