#include <bits/stdc++.h>
using namespace std;
int vis[10000];
long long b, c, w, a, x, olda, oldc;
void nexc() { c--; }
void nexb() {
  b -= x;
  if (b < 0) {
    a--;
    b += w;
  }
}
int main() {
  cin >> a >> b >> w >> x >> c;
  oldc = c;
  olda = a;
  while (c > a) {
    vis[b] = 1;
    nexc();
    nexb();
    if (vis[b]) {
      break;
    }
  }
  if (c <= a) {
    cout << oldc - c << endl;
    return 0;
  }
  long long tot1 = oldc - c, tot2 = olda - a;
  long long u = (c - a - 1) / (tot1 - tot2);
  c -= u * tot1;
  a -= u * tot2;
  while (c > a) {
    nexc();
    nexb();
  }
  cout << oldc - c << endl;
  return 0;
}
