#include <bits/stdc++.h>
using namespace std;
const int maxn = 23333;
int aa[maxn];
int p[maxn];
int main() {
  int a, b, w, x, c;
  scanf("%d%d%d%d%d", &a, &b, &w, &x, &c);
  c -= a;
  if (c <= 0) {
    printf("0\n");
    return 0;
  }
  int m = 0, haj;
  for (int i = b; !p[i];) {
    p[i] = ++m;
    if (i >= x) {
      i -= x;
      aa[m] = 1;
    } else {
      i = w - x + i;
    }
    if (p[i]) haj = p[i];
  }
  for (int i = 1; i < haj; ++i) {
    c -= aa[i];
    if (c <= 0) {
      printf("%d\n", i);
      return 0;
    }
  }
  long long sum = (long long)haj - 1;
  int s = 0;
  for (int i = haj; i <= m; ++i) s += aa[i];
  sum += (long long)((c - 1) / s) * (long long)(m - haj + 1);
  c -= ((c - 1) / s) * s;
  for (int i = haj; i <= m && c > 0; ++i) {
    c -= aa[i];
    ++sum;
  }
  printf("%I64d\n", sum);
}
