#include <bits/stdc++.h>
using namespace std;
int b, w, x;
int Ttime[1002], des[1002], ver[1002], sum[1002];
bool ok[1002];
int n;
long long kq, a, c;
int main() {
  cin >> a >> b >> w >> x >> c;
  while ((c > a) && (b >= x)) {
    kq++;
    c--;
    b -= x;
  }
  if (c <= a) {
    cout << kq;
    return 0;
  }
  for (int i = 0; i <= x - 1; i++) {
    Ttime[i] = 1;
    int bb = w - (x - i);
    while (bb >= x) {
      Ttime[i]++;
      bb -= x;
    }
    des[i] = bb;
  }
  int j = des[b];
  while (!ok[des[j]]) {
    ok[des[j]] = true;
    j = des[j];
  }
  while ((b != j)) {
    if (c - Ttime[b] <= a - 1) {
      cout << kq + c - a + 1;
      return 0;
    }
    c -= Ttime[b];
    kq += Ttime[b];
    a--;
    b = des[b];
  }
  ver[1] = j;
  int i = j;
  n = 1;
  sum[1] = Ttime[j];
  while (des[j] != i) {
    n++;
    j = des[j];
    ver[n] = j;
    sum[n] = sum[n - 1] + Ttime[j];
  }
  long long t = (c - a) / (sum[n] - n);
  if ((c - a) % (sum[n] - n) == 0) t--;
  kq += t * sum[n];
  c -= t * sum[n];
  a -= t * n;
  for (int i = 1; i <= n; i++) {
    if (c - (sum[i] - sum[i - 1]) <= a - 1) {
      cout << kq + c - a + 1;
      return 0;
    }
    c -= sum[i] - sum[i - 1];
    kq += sum[i] - sum[i - 1];
    a--;
  }
}
