#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  int a, b, w, x, c;
  cin >> a >> b >> w >> x >> c;
  if (c <= a) {
    cout << "0\n";
    return 0;
  }
  if (c - b / x <= a) {
    cout << c - a << "\n";
    return 0;
  }
  long long k = b / x;
  c -= b / x;
  b = b % x;
  b += w - x;
  a--;
  k++;
  c--;
  if (c <= a) {
    cout << k << "\n";
    return 0;
  }
  vector<bool> vis(10000, false);
  vis[b] = true;
  while (true) {
    if (c <= a) {
      cout << k << "\n";
      return 0;
    }
    int bn = (b >= x) ? (b - x) : (b + w - x);
    k++;
    c--;
    if (b < x) a--;
    if (c <= a) {
      cout << k << "\n";
      return 0;
    }
    b = bn;
    if (vis[bn]) break;
    vis[bn] = true;
  }
  if (c <= a) {
    cout << k << "\n";
    return 0;
  }
  for (int i = 0; i < 5000; i++) vis[i] = false;
  vis[b] = true;
  int C = 0, dA = 0;
  while (true) {
    if (c <= a) {
      cout << k << "\n";
      return 0;
    }
    int bn = (b >= x) ? (b - x) : (b + w - x);
    k++;
    c--;
    C++;
    if (b < x) {
      a--;
      dA++;
    }
    if (c <= a) {
      cout << k << "\n";
      return 0;
    }
    b = bn;
    if (vis[bn]) break;
    vis[bn] = true;
  }
  if (c <= a) {
    cout << k << "\n";
    return 0;
  }
  int rep = (c - a) / (C - dA) - 5;
  if (rep > 0) {
    c -= rep * C;
    a -= rep * dA;
    k += (long long)rep * C;
  }
  if (c <= a) {
    cout << k << "\n";
    return 0;
  }
  while (true) {
    int bn = (b >= x) ? (b - x) : (b + w - x);
    k++;
    c--;
    if (b < x) a--;
    if (c <= a) {
      cout << k << "\n";
      return 0;
    }
    b = bn;
  }
  return 0;
}
