#include <bits/stdc++.h>
using namespace std;
long long a, b, w, x, c;
long long m, n;
long long t, i = 0, j = 0, k = 0;
long long cur;
int main() {
  cin >> a >> b >> w >> x >> c;
  m = c;
  n = a;
  cur = b;
  while (c > a) {
    c--;
    i++;
    if (b >= x)
      b -= x;
    else {
      a--;
      b += w - x;
      j++;
    }
    if (b == cur) break;
  }
  if (c <= a) {
    cout << i << endl;
    return 0;
  }
  t = (m - n) / (i - j);
  if ((m - n) % (i - j) == 0) t--;
  c = m - t * i;
  a = n - t * j;
  while (c > a) {
    c--;
    k++;
    if (b >= x)
      b -= x;
    else {
      a--;
      b += w - x;
    }
  }
  cout << t * i + k << endl;
  return 0;
}
