#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long t = 0, i = 0, j = 0, n = 0, k = 0, num = 0, temp = 0;
  long long a, b, w, x, c;
  cin >> a >> b >> w >> x >> c;
  bool v[1002] = {false};
  long long arr[1002] = {0};
  arr[0] = 0;
  while (true) {
    if (v[b] == true) break;
    v[b] = true;
    ++i;
    arr[i] = arr[i - 1];
    if (b >= x)
      b -= x;
    else {
      b += (w - x);
      arr[i]++;
    }
  }
  if (c <= a) {
    cout << "0";
    return 0;
  }
  k = i - arr[i];
  num = (c - a) / k;
  if ((c - a) % k == 0) num--;
  temp = num * i;
  j = c - a;
  j -= k * num;
  for (n = 0; n <= i; ++n) {
    if (n - arr[n] == j) break;
  }
  temp += n;
  cout << temp;
  return 0;
}
