#include <bits/stdc++.h>
using namespace std;
const int MAX_W = 1000;
const int BN = 60;
const long long LINF = 1LL << 60;
int ps[MAX_W][BN];
long long ts[MAX_W][BN];
inline long long calc(int u, long long t) {
  long long sum = 0, bk = 1;
  for (int k = 0; k < BN; k++, bk <<= 1)
    if ((t & bk) != 0) {
      sum += ts[u][k];
      u = ps[u][k];
    }
  return sum;
}
int main() {
  int a, b, w, x, c;
  scanf("%d%d%d%d%d", &a, &b, &w, &x, &c);
  for (int i = 0; i < w; i++) {
    if (i >= x)
      ps[i][0] = i - x, ts[i][0] = 0;
    else
      ps[i][0] = w - (x - i), ts[i][0] = 1;
  }
  for (int k = 0; k + 1 < BN; k++)
    for (int i = 0; i < w; i++) {
      ps[i][k + 1] = ps[ps[i][k]][k];
      ts[i][k + 1] = ts[i][k] + ts[ps[i][k]][k];
    }
  long long t0 = -1, t1 = LINF;
  while (t0 + 1 < t1) {
    long long t = (t0 + t1) / 2;
    if (a - calc(b, t) >= c - t)
      t1 = t;
    else
      t0 = t;
  }
  printf("%lld\n", t1);
  return 0;
}
