Arthur and Alexander are number busters. Today they've got a competition. Arthur took a group of four integers a, b, w, x (0 ≤ b < w, 0 < x < w) and Alexander took integer с. Arthur and Alexander use distinct approaches to number bustings. Alexander is just a regular guy. Each second, he subtracts one from his number. In other words, he performs the assignment: c = c - 1. Arthur is a sophisticated guy. Each second Arthur performs a complex operation, described as follows: if b ≥ x, perform the assignment b = b - x, if b < x, then perform two consecutive assignments a = a - 1; b = w - (x - b).You've got numbers a, b, w, x, c. Determine when Alexander gets ahead of Arthur if both guys start performing the operations at the same time. Assume that Alexander got ahead of Arthur if c ≤ a.

The first line contains integers a, b, w, x, c (1 ≤ a ≤ 2·109, 1 ≤ w ≤ 1000, 0 ≤ b < w, 0 < x < w, 1 ≤ c ≤ 2·109).

Print a single integer — the minimum time in seconds Alexander needs to get ahead of Arthur. You can prove that the described situation always occurs within the problem's limits.

/**
 * Created by Anna.Skobaneva on 1/17/14.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class TaskB {

    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws NumberFormatException,
            IOException {
        TaskB solver = new TaskB();
        solver.open();
        long time = System.currentTimeMillis();
        solver.solve();
        if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {
            System.out.println("Spent time: "
                    + (System.currentTimeMillis() - time));
            System.out.println("Memory: "
                    + (Runtime.getRuntime().totalMemory() - Runtime
                    .getRuntime().freeMemory()));
        }
        solver.close();
    }

    public void open() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter(new FileWriter("output.txt"));
    }

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null)
                return null;
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

    boolean hasMoreTokens() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null)
                return false;
            st = new StringTokenizer(line);
        }
        return true;
    }

    class Pair {
        int cnt;
        int value;

        Pair(int cnt, int value) {
            this.cnt = cnt;
            this.value = value;
        }
    }

    public void solve() throws NumberFormatException, IOException {

        long a = nextLong();
        long b = nextLong();
        long w = nextLong();
        long x = nextLong();
        long c = nextLong();

        if (c <= a) {
            out.println(0);
        } else
            out.println((long) Math.ceil((-b + (c - a) * x + 0.0) / (w - x)) + c - a);
    }

    public void close() {
        out.flush();
        out.close();
    }
}

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Agostinho Junior
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
	OutputWriter out;
	InputReader in;
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		this.in = in; this.out = out;
		int a = in.readInt();
		int b = in.readInt();
		int w = in.readInt();
		int x = in.readInt();
		int d = in.readInt() - a;
		final int N = 2000;
		long[] lastTime = new long[N];
		int[] lastD = new int[N];
		long time = 0;
		while (d > 0) {
			if (x <= b) {
				int diff = Math.min((b - x) / x + 1, d);
				time += Math.min(d, diff);
				d -= diff;
				b -= x * diff;
				if (lastTime[b] > 0) {
					diff = d / (lastD[b] - d);
					d -= diff * (lastD[b] - d);
					time += diff * (time - lastTime[b]);
				}
				lastTime[b] = time;
				lastD[b] = d;
			} else {
				b += w - x;
				time++;
				lastTime[b] = time;
				lastD[b] = d;
			}
		}
		out.println(time);
	}
}

class OutputWriter {
	private PrintWriter output;
	public OutputWriter() {
		this(System.out);
	}
	public OutputWriter(OutputStream out) {
		output = new PrintWriter(out);
	}
	public OutputWriter(Writer writer) {
		output = new PrintWriter(writer);
	}
	public void println(Object o) {
		output.println(o);
	}
	public void close() {
		output.close();
	}
}

class InputReader {
	private BufferedReader input;
	private StringTokenizer line = new StringTokenizer("");
	public InputReader() {
		this(System.in);
	}
	public InputReader(InputStream in) {
		input = new BufferedReader(new InputStreamReader(in));
	}
	public InputReader(String s) {
		try {
			input = new BufferedReader(new FileReader(s));
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public void fill() {
		try {
			if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public int readInt() {
		fill();
		return Integer.parseInt(line.nextToken());
	}
}

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Agostinho Junior
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
	OutputWriter out;
	InputReader in;
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		this.in = in; this.out = out;
		int a = in.readInt();
		int b = in.readInt();
		int w = in.readInt();
		int x = in.readInt();
		int d = in.readInt() - a;
		final int N = 2000;
		long[] lastTime = new long[N];
		int[] lastD = new int[N];
		long time = 0;
		while (d > 0) {
			if (x <= b) {
				int diff = Math.min((b - x) / x + 1, d);
				time += Math.min(d, diff);
				d -= diff;
				b -= x * diff;
				if (lastTime[b] > 0) {
					diff = d / (lastD[b] - d);
					d -= diff * (lastD[b] - d);
					time += diff * (time - lastTime[b]);
				}
			} else {
				b += w - x;
				time++;
			}
			lastTime[b] = time;
			lastD[b] = d;
		}
		out.println(time);
	}
}

class OutputWriter {
	private PrintWriter output;
	public OutputWriter() {
		this(System.out);
	}
	public OutputWriter(OutputStream out) {
		output = new PrintWriter(out);
	}
	public OutputWriter(Writer writer) {
		output = new PrintWriter(writer);
	}
	public void println(Object o) {
		output.println(o);
	}
	public void close() {
		output.close();
	}
}

class InputReader {
	private BufferedReader input;
	private StringTokenizer line = new StringTokenizer("");
	public InputReader() {
		this(System.in);
	}
	public InputReader(InputStream in) {
		input = new BufferedReader(new InputStreamReader(in));
	}
	public InputReader(String s) {
		try {
			input = new BufferedReader(new FileReader(s));
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public void fill() {
		try {
			if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public int readInt() {
		fill();
		return Integer.parseInt(line.nextToken());
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;

public class B {

    static long compute(long a, int b, int w, int x, long c) {
        int b0=b;
        if(a>=c) {
            return 0;
        }

        long[] len=new long[w];
        long[] dec=new long[w];
        Arrays.fill(len, -1);
        Arrays.fill(dec, -1);

        long l=0, d=0, plen, pdec, clen, cdec;
        while(true) {
            if(len[b]<0) {
                len[b]=l;
                dec[b]=d;
            } else {
                plen=len[b]; pdec=dec[b];
                clen=l-plen; cdec=d-pdec;
                break;
            }
            if(b>=x) {
                long k=b/x;
                b=b%x;
                l+=k;
            } else {
                b=w-(x-b);
                l++;
                d++;
            }
        }

        if(a-pdec>=c-plen) {
            return compute2(a, b0, w, x, c);
        } else {
            a-=pdec; c-=plen;
            long k=(c-a)/(clen-cdec);
            if(k>0) {
                k--;
            }
            a-=cdec*k; c-=clen*k;
            return plen+k*clen+compute2(a, b, w, x, c);
        }
    }

    static long compute2(long a, int b, int w, int x, long c) {
        int ret=0;
        if(a>=c) {
            return 0;
        } else {
            while(true) {
                if(b>=x) {
                    int k=b/x;
                    if(c-a<=k) {
                        return ret+(c-a);
                    }
                    c-=k;
                    b=b%x;
                    ret+=k;
                } else {
                    c--;
                    a--;
                    b=w-(x-b);
                    ret++;
                }
            }
        }
    }

    static void run_stream(InputStream ins) throws IOException {
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        String[] s=r.readLine().split(" ");

        int a=Integer.parseInt(s[0]);
        int b=Integer.parseInt(s[1]);
        int w=Integer.parseInt(s[2]);
        int x=Integer.parseInt(s[3]);
        int c=Integer.parseInt(s[4]);
        System.out.println(compute(a,b,w,x,c));
        //System.out.println(compute2(a,b,w,x,c));
    }

    public static void main(String[] args) throws IOException {
        run_stream(System.in);

        //run_random();
    }

    static Random rnd=new Random();
    static void run_random() {
        for (int i=0; i<10000; i++) {
            int a=rnd.nextInt(100)+1;
            int b=rnd.nextInt(20)+1;
            int x=rnd.nextInt(20)+1;
            int w=Math.max(b, x)+rnd.nextInt(100)+1;
            int c=a+rnd.nextInt(200);

            try{
                long r1=compute(a,b,w,x,c);
                long r2=compute2(a,b,w,x,c);
                if(r1!=r2) {
                    System.out.println(a+" "+b+" "+w+" "+x+" "+c);
                }
            } catch(Exception e) {
                System.out.println(e);
                System.out.println(a+" "+b+" "+w+" "+x+" "+c);
            }
        }

    }

}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;

import static java.util.Arrays.*;

public class B {
	private static final int mod = (int)1e9+7;

	final Random random = new Random(0);
	final IOFast io = new IOFast();

	public void run() throws IOException {
		int a = io.nextInt();
		int b = io.nextInt();
		int w = io.nextInt();
		int x = io.nextInt();
		int c = io.nextInt();
		int[] prev = new int[1000];
		int[] prevA = new int[1000];
		Arrays.fill(prev, -1);
		long ans = Long.MAX_VALUE;
		for(int i = 0; i < 3 * 1000; i++) {
			if(c <= a) {
				io.out.println(i);
//				io.out.println(ans);
				return;
			}
//			io.out.println(i + " " + b);
			if(prev[b] != -1) {
				int cycle = i - prev[b];
//				io.out.println(i + " " + cycle + " " + (i + (c - a + cycle - 1) / cycle * cycle));
				long low = -1, high = 1L<<50;
				final int m = prevA[b] - a;
				while(high - low > 1) {
					long mid = (low + high) / 2;
					if(c - mid * cycle <= a - mid * m) {
						high = mid;
					}
					else {
						low = mid;
					}
				}
//				io.out.println(i + " " + c + " " + a + " " + cycle + " " + high);
				ans = Math.min(ans, i + cycle * high);
			}
			prevA[b] = a;
			prev[b] = i;
			c--;
			if(b >= x) { b -= x; }
			else { a--; b = w - x + b; }
		}
		io.out.println(ans);
	}

	static void radixSort(int[] xs) {
		int[] cnt = new int[(1<<16)+1];
		int[] ys = new int[xs.length];

		for(int j = 0; j <= 16; j += 16) {
			Arrays.fill(cnt, 0);
			for(int x : xs) { cnt[(x>>j&0xFFFF)+1]++; }
			for(int i = 1; i < cnt.length; i++) { cnt[i] += cnt[i-1]; }
			for(int x : xs) { ys[cnt[x>>j&0xFFFF]++] = x; }
			{ final int[] t = xs; xs = ys; ys = t; }
		}
	}

	static void radixSort(long[] xs) {
		int[] cnt = new int[(1<<16)+1];
		long[] ys = new long[xs.length];

		for(int j = 0; j <= 48; j += 16) {
			Arrays.fill(cnt, 0);
			for(long x : xs) { cnt[(int)(x>>j&0xFFFF)+1]++; }
			for(int i = 1; i < cnt.length; i++) { cnt[i] += cnt[i-1]; }
			for(long x : xs) { ys[cnt[(int)(x>>j&0xFFFF)]++] = x; }
			{ final long[] t = xs; xs = ys; ys = t; }
		}
	}

	static void arrayIntSort(int[][] x, int... keys) {
		Arrays.sort(x, new ArrayIntsComparator(keys));
	}

	static class ArrayIntsComparator implements Comparator<int[]> {
		final int[] KEY;

		public ArrayIntsComparator(int... key) {
			KEY = key;
		}

		@Override
		public int compare(int[] o1, int[] o2) {
			for(int k : KEY) if(o1[k] != o2[k]) return o1[k] - o2[k];
			return 0;
		}
	}

	static class ArrayIntComparator implements Comparator<int[]> {
		final int KEY;

		public ArrayIntComparator(int key) {
			KEY = key;
		}

		@Override
		public int compare(int[] o1, int[] o2) {
			return o1[KEY] - o2[KEY];
		}
	}

	void main() throws IOException {
		//		IOFast.setFileIO("rle-size.in", "rle-size.out");
		try {
			run();
		}
		catch (EndOfFileRuntimeException e) { }
		io.out.flush();
	}

	public static void main(String[] args) throws IOException {
		new B().main();
	}

	static class EndOfFileRuntimeException extends RuntimeException {
		private static final long serialVersionUID = -8565341110209207657L; }

	static
	public class IOFast {
		private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		private PrintWriter out = new PrintWriter(System.out);

		void setFileIO(String ins, String outs) throws IOException {
			in = new BufferedReader(new FileReader(ins));
			out = new PrintWriter(new FileWriter(outs));
		}

		//		private static final int BUFFER_SIZE = 50 * 200000;
		private static int pos, readLen;
		private static final char[] buffer = new char[1024 * 8];
		private static char[] str = new char[500*8*2];
		private static boolean[] isDigit = new boolean[256];
		private static boolean[] isSpace = new boolean[256];
		private static boolean[] isLineSep = new boolean[256];

		static {
			for(int i = 0; i < 10; i++) { isDigit['0' + i] = true; }
			isDigit['-'] = true;
			isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
			isLineSep['\r'] = isLineSep['\n'] = true;
		}

		public int read() throws IOException {
			if(pos >= readLen) {
				pos = 0;
				readLen = in.read(buffer);
				if(readLen <= 0) { throw new EndOfFileRuntimeException(); }
			}
			return buffer[pos++];
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(nextString());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(nextString());
		}

		public char nextChar() throws IOException {
			while(true) {
				final int c = read();
				if(!isSpace[c]) { return (char)c; }
			}
		}

		int reads(int len, boolean[] accept) throws IOException {
			try {
				while(true) {
					final int c = read();
					if(accept[c]) { break; }

					if(str.length == len) {
						char[] rep = new char[str.length * 3 / 2];
						System.arraycopy(str, 0, rep, 0, str.length);
						str = rep;
					}

					str[len++] = (char)c;
				}
			}
			catch(EndOfFileRuntimeException e) { ; }

			return len;
		}

		int reads(char[] cs, int len, boolean[] accept) throws IOException {
			try {
				while(true) {
					final int c = read();
					if(accept[c]) { break; }
					cs[len++] = (char)c;
				}
			}
			catch(EndOfFileRuntimeException e) { ; }

			return len;
		}

		public char[] nextLine() throws IOException {
			int len = 0;
			str[len++] = nextChar();
			len = reads(len, isLineSep);

			try {
				if(str[len-1] == '\r') { len--; read(); }
			}
			catch(EndOfFileRuntimeException e) { ; }

			return Arrays.copyOf(str, len);
		}

		public String nextString() throws IOException {
			return new String(next());
		}

		public char[] next() throws IOException {
			int len = 0;
			str[len++] = nextChar();
			len = reads(len, isSpace);
			return Arrays.copyOf(str, len);
		}

		public int next(char[] cs) throws IOException {
			int len = 0;
			cs[len++] = nextChar();
			len = reads(cs, len, isSpace);
			return len;
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(nextString());
		}

		public long[] nextLongArray(final int n) throws IOException {
			final long[] res = new long[n];
			for(int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public int[] nextIntArray(final int n) throws IOException {
			final int[] res = new int[n];
			for(int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[][] nextIntArray2D(final int n, final int k) throws IOException {
			final int[][] res = new int[n][];
			for(int i = 0; i < n; i++) {
				res[i] = nextIntArray(k);
			}
			return res;
		}

		public int[][] nextIntArray2DWithIndex(final int n, final int k) throws IOException {
			final int[][] res = new int[n][k+1];
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < k; j++) {
					res[i][j] = nextInt();
				}
				res[i][k] = i;
			}
			return res;
		}

		public double[] nextDoubleArray(final int n) throws IOException {
			final double[] res = new double[n];
			for(int i = 0; i < n; i++) {
				res[i] = nextDouble();
			}
			return res;
		}

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	public static void main(String args[]) throws NumberFormatException,
	IOException {
		Stdin in=new Stdin();
		PrintWriter out = new PrintWriter(System.out);
		long a,b,w,x,c;
		a=in.readLong();
		b=in.readLong();
		w=in.readLong();
		x=in.readLong();
		c=in.readLong();
		if(a>=c)
			out.println(0);
		else{
			ArrayList<Long> period=getPeriod(b,x,w);
			int change=0;
			for(long i:period)
				if(i<x)
					change++;

			long dif=c-a;
			long round=dif/(period.size()-change);
			long currentC=c-period.size()*(round-1);
			long currentA=a-(round-1)*change;
			long time=(round-1)*period.size();
			while(currentC>currentA){
				if(b>=x){
					b-=x;

				}
				else{
					b=w-(x-b);
					currentA--;
				}
				currentC--;
				time++;
			}

			out.print(time);
		}
		out.flush();
	}
	private static ArrayList<Long> getPeriod(long b,long x,long w){
		ArrayList<Long>p=new ArrayList<Long>();

		long b1=b;
		p.add(b1);
		if(b1>=x){
			b1-=x;

		}
		else{
			b1=w-(x-b1);

		}
		while(b1!=b){
			p.add(b1);
			if(b1>=x){
				b1-=x;

			}
			else{
				b1=w-(x-b1);

			}
		}
		return p;
	}
	private static class Stdin {
		InputStreamReader read;
		BufferedReader br;

		StringTokenizer st=new StringTokenizer("");
		private Stdin() {
			read = new InputStreamReader(System.in);
			br = new BufferedReader(read);

		}

		private String readNext() throws IOException{

			while(!st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		private int readInt() throws IOException ,NumberFormatException{

			return Integer.parseInt(readNext());

		}

		private long readLong() throws IOException ,NumberFormatException{

			return Long.parseLong(readNext());

		}
	}
}

import java.util.*;
import java.io.*;
public class Main {
    static BufferedReader reader
		= new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();

    static long a, b, w, x, c;
    public static void main(String[] args){
        long[] z = nextLongArray();
        a= z[0]; b= z[1]; w= z[2]; x= z[3]; c = z[4];
        System.out.println(binary((long) (5 * Math.pow(10, 18)), 0));
    }
    static long binary(long big, long small)
    {
        if (big - small <= 1)
            return okay(small) ? small : big;
        long m = (big + small) / 2;
        return okay(m) ? binary(m, small) : binary(big, m);
    }
    static boolean okay(long n)
    {
        long result = b - n * x;
        long numTimesToAddW = result >= 0 ? 0 : (long) Math.ceil((double) -result / w);
        return c - n <= a - numTimesToAddW;
    }

    // the followings are methods to take care of inputs.
    static int nextInt(){
        return Integer.parseInt(nextLine());
    }
    static long nextLong(){
        return Long.parseLong(nextLine());
    }
    static int[] nextIntArray(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length]; for (int i = 0; i < ary.length; i++){
            ary[i] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static int[] nextIntArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArray(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length];
        for (int i = 0; i < inp.length; i++){
            ary[i] = Long.parseLong(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Long.parseLong(inp[i]);
        }
        return ary;
    }
	static String nextLine(){
		try {
			return reader.readLine().trim();
		} catch (Exception e){}
		return null;
	}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Hashtable;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        Hashtable<Long, Long> table = new Hashtable<Long, Long>();
        long a = in.nextLong(), b = in.nextLong(), w = in.nextLong(), x = in.nextLong(), c = in.nextLong();
        if(a >= c) {
            out.printLine(0);
            return;
        }
        long k = b, p = 0, q = 0;
        long time = 0;
        table.put(k, 0L);
        while (true) {
            if(a - p >= c - time) {
                out.printLine(time);
                return;
            }
            time++;

            if(k >= x) {
                k -= x;
            }
            else {
                k += (w - x);
                p++;
            }
            if(table.containsKey(k)) {
                q = time;
                break;
            }
            table.put(k, time);
            //DebugUtils.prlong(a - p, c - time, time, k);
        }
        long value = k, r = time;
        a-= p;
        c -= q;
        p = 0;
        q = 0;
        time = 0;
        //DebugUtils.prlong(a, c, time, k);

        while (true) {
            if(a - p >= c - time) {
                out.printLine(time + r);
                return;
            }
            time++;
            if(k >= x) {
                k -= x;

            }
            else {
                k += (w - x);
                p++;
            }
            if(k == value) {
                q = time;
                break;
            }
        }
        //DebugUtils.prlong(c, a, q, p);
        if((c - a) % (q - p) == 0) {
            long cycles = (c - a) / (q - p) - 1;
            r += time * cycles;
            a -= p * cycles;
            c -= q * cycles;
            k = value;
            time = 0;
            while (true) {
                if(a >= c) {
                    out.printLine(time + r);
                    return;
                }
                time++;
                c--;
                if(k >= x) {
                    k -= x;

                }
                else {
                    k += (w - x);
                    a--;
                }
            }
        } else {
            long cycles = (c - a) / (q - p);
            r += time * cycles;
            a -= p * cycles;
            c -= q * cycles;
            k = value;
            time = 0;
            while (true) {
                if(a >= c) {
                    out.printLine(time + r);
                    return;
                }
                time++;
                c--;
                if(k >= x) {
                    k -= x;

                }
                else {
                    k += (w - x);
                    a--;
                }
            }
        }
    }
}

class InputReader
{
    BufferedReader in;
    StringTokenizer tokenizer=null;

    public InputReader(InputStream inputStream)
    {
        in=new BufferedReader(new InputStreamReader(inputStream));
    }
    public String next()
    {
        try{
            while (tokenizer==null||!tokenizer.hasMoreTokens())
            {
                tokenizer=new StringTokenizer(in.readLine());
            }
            return tokenizer.nextToken();
        }
        catch (IOException e)
        {
            return null;
        }
    }
    public long nextLong()
    {
        return Long.parseLong(next());
    }
    }

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}
}

import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.File;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author monsterspy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        Output out = new Output(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, FastScanner s, Output ww) {
        try {
            long a = s.nextLong();
            long b = s.nextLong();
            long w = s.nextLong();
            long x = s.nextLong();
            long c = s.nextLong();

            double ret = ((a - c) * w + b) * 1. / (x - w);
            long ans = (long) Math.ceil(ret);

            if (ans < 0 || c <= a) ans = 0;
            ww.print(ans);
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}

class FastScanner {
    BufferedReader s;
    StringTokenizer st;

    public FastScanner(InputStream InputStream){
        st = new StringTokenizer("");
        s = new BufferedReader(new InputStreamReader(InputStream));
    }

    public FastScanner(File f) throws FileNotFoundException{
        st = new StringTokenizer("");
        s = new BufferedReader (new FileReader(f));
    }

    public long nextLong() throws IOException{
        if(st.hasMoreTokens())
            return Long.parseLong(st.nextToken());
        else{
            st = new StringTokenizer(s.readLine());
            return nextLong();
        }
    }

}

class Output {

    private final PrintWriter writer;

    public Output(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public Output(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void close() {
        writer.close();
    }

}

public class B {

	private final static boolean autoflush = false;

	public B () {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int W = sc.nextInt();
		int X = sc.nextInt();
		int C = sc.nextInt();

		int [] D = new int [W];
		int v = 0, w = 0, b = B;

		do  {
			if (b >= X) b -= X;
			else { b = W - (X - b); D[v] = 1; ++w; }
			++v;
		} while (b != B);

		long M = (C - A - 1) / (v - w), res = 0;
		if (M > 0) {
			res += M*v;
			A -= M*w;
			C -= M*v;
		}

		int i = 0;
		while (C > A) {
			--C;
			A -= D[i++];
			++res;
		}

		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static MyScanner sc = new MyScanner();
	private static class MyScanner {
		public String next() { newLine(); return line[index++]; }
		public int nextInt() { return Integer.parseInt(next()); }
		//////////////////////////////////////////////
		private boolean eol() { return index == line.length; }
		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final java.io.BufferedReader r;
		private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
		private MyScanner (java.io.BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private String [] line;
		private int index;
		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}
	private static void print (Object o, Object... a) { printDelim(" ", o, a); }
	private static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }
	private static void exit (Object o, Object... a) { print(o, a); exit(); }
	private static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.substring(delim.length());
	}
	private static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i = 0; i < L; ++i)
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void start() { t = millis(); }
	private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);
	private static long t;
	private static long millis() { return System.currentTimeMillis(); }
	public static void main (String[] args) { new B(); exit(); }
}

import java.io.*;
import java.util.*;

public class CF {

	HashMap<Long, Long> lastMove = new HashMap<>();
	HashMap<Long, Long> wasDiff = new HashMap<>();

	long getAns(long a, long b, long w, long x, long c, long nowMove) {
//		System.err.println(a+" " + b + " " + w + " " + x + " " + c + " " + nowMove);
		wasDiff.put(nowMove, c - a);
		if (c<=a)
			return nowMove;
		Long lastMoveWithSameB = lastMove.get(b);
		if (lastMoveWithSameB != null) {
			long wasD = wasDiff.get(lastMoveWithSameB);
			long changed = wasD - (c - a);
			long canDoMore = (c - a - 1) / changed;
			if (canDoMore > 0) {
				nowMove += canDoMore * (nowMove - lastMoveWithSameB);
				c -= canDoMore * changed;
			}
		}
		lastMove.put(b, nowMove);
		if (b >= x) {
			b = b - x;
		} else {
			a--;
			b = w - (x - b);
		}
		c--;
		nowMove++;
		return getAns(a, b, w, x, c, nowMove);
	}

	void solve() {
		out.println(getAns(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), 0));
	}

	FastScaner in;
	PrintWriter out;

	void run() {
		in = new FastScaner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	void runWithFiles() {
		in = new FastScaner(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		solve();

		out.close();
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		new CF().run();
	}

	class FastScaner {
		BufferedReader br;
		StringTokenizer st;

		FastScaner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		FastScaner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

import java.io.*;
import java.util.*;

public class cf382b {
  static FastIO in = new FastIO(), out = in;

  public static void main(String[] args) {
    long a = in.nextInt();
    long b = in.nextInt();
    long w = in.nextInt();
    long x = in.nextInt();
    long c = in.nextInt();

    double ret = ((a-c)*w + b) * 1. / (x-w);
    long ans = (long)Math.ceil(ret);

    if(ans < 0 || c <= a) ans = 0;
    out.println(ans);

    out.close();
  }

  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in, System.out);
    }

    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }

    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }

    public int numTokens() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }

    public String next() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nipuna Samarasekara
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
   /////////////////////////////////////////////////////////////
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        long a=in.nextLong();
        long b=in.nextLong();
        long w=in.nextLong();
        long x=in.nextLong();
        long c=in.nextLong();
        long s=w-x;
        long gap=c-a;
        long ans=0;
        if(gap<=0){
            out.println(0);
            return;
        }
        if(b>=x){
            gap-= b/x;
            ans+=b/x;
            b%=x;
        }
        if(gap<=0){
            ans+=gap;
            out.println(ans);
            return;
        }
     //   System.out.println(gap);
        long[] red = new long[(int)x];
        long[] bval = new long[(int)x];
        long[] inct = new long[(int)x];
        for (int i = 0; i < x; i++) {
            long hh= (x-i+s-1)/s;
            long bn=i+hh*s;
            inct[i]=hh;
            red[i]=bn/x;
            bval[i]=bn%x;
        }
        int ct=0;
        while(ct<=x&&gap>0){
            ans+=inct[(int)b];
            gap-=red[(int)b];
            ans+=red[(int)b];

            b=bval[(int)b];
           ct++;

        }

        long addt=0;
        long cycle=0;
        long sb=b,bb=b;
        cycle+=red[(int)sb];
        sb=bval[(int)sb];
        addt+=inct[(int)sb];

        while(sb!=bb){
            cycle+=red[(int)sb];
            sb=bval[(int)sb];
            addt+=inct[(int)sb];
        }
        long jj=gap/cycle;
        ans+=jj*cycle;
        gap%=cycle;
        ans+=jj*addt;
        sb=bb;
        while(gap>0){
            ans+=inct[(int)sb];
            gap-=red[(int)sb];
            ans+=red[(int)sb];

            sb=bval[(int)sb];

        }
        ans+=gap;
        out.println(ans);

    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        if (c < 0) {
            return null;
        }
        while (c >= 0 && !isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    }

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

    public FastPrinter(Writer out) {
        super(out);
    }

}

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		B solver = new B();
		solver.solve(1, in, out);
		out.close();
	}
}

class B {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        long a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        long c = in.nextInt();
        int[] to = new int[w];
        int[] cost = new int[w];
        Graph g = new Graph(w, w);
        for (int i = w - 1, j = i - x; i >= 0; i--, j = j == 0 ? w - 1 : j - 1) {
            cost[i] = i < x ? -1 : 0;
            to[i] = j;
            g.addDirectedWeightedEdge(i, j, cost[i]);
        }
        BellmanFord bf = new BellmanFord(g);
        bf.getDist(b);
        long moves = 0;
        while (b != bf.cycleStart && c --> a) {
            a += cost[b];
            b = to[b];
            moves++;
        }
        if (c > a) {
            int cycleCost = -cost[b];
            int cycleLength = bf.cycleVertices().length;
            for (int curr = to[b]; curr != b; curr = to[curr]) {
                cycleCost -= cost[curr];
            }
            for (long i = 50, aDiff = cycleCost * (1L << i), cDiff = cycleLength * (1L << i); i >= 0; i--, aDiff >>= 1, cDiff >>= 1) {
                if (a - aDiff < c - cDiff) {
                    a -= aDiff;
                    c -= cDiff;
                    moves += cDiff;
                }
            }
            while (c --> a) {
                a += cost[b];
                b = to[b];
                moves++;
            }
        }
        out.println(moves);
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class Graph {

    public IntArrayList to;
    public IntArrayList flow;
    public IntArrayList cost;
    public IntArrayList reverse;
    public IntDeque edges[];
    public int vertexCount;
    public int edgeCount;
    public int inDegree[];
    public int outDegree[];

    public Graph(int vertexCount) {
        this(vertexCount, 16);
    }

    public Graph(int vertexCount, int edgeCount) {
        this.to = new IntArrayList(edgeCount);
        this.flow = new IntArrayList(edgeCount);
        this.cost = new IntArrayList(edgeCount);
        this.reverse = new IntArrayList(edgeCount);
        this.edges = new IntDeque[vertexCount];
        this.vertexCount = vertexCount;
        this.edgeCount = 0;
        this.inDegree = new int[vertexCount];
        this.outDegree = new int[vertexCount];
        for (int i = 0; i < vertexCount; i++) {
            edges[i] = new IntDeque();
        }
    }

    public void addDirectedWeightedEdge(int u, int v, int edgeCost) {
        to.add(v);
        flow.add(0);
        cost.add(edgeCost);
        reverse.add(-1);
        edges[u].add(edgeCount);
        inDegree[v]++;
        outDegree[u]++;
        edgeCount++;
    }

    }

class BellmanFord {

    public final long INFINITY = Long.MAX_VALUE;
    public long[] dist;
    public int[] prev;
    boolean[] queued;
    public boolean hasCycle;
    public int cycleStart;
    Graph g;

    public BellmanFord(Graph g) {
        dist = new long[g.vertexCount];
        prev = new int[g.vertexCount];
        queued = new boolean[g.vertexCount];
        this.g = g;
    }
    public long[] getDist(int src) {
        Arrays.fill(dist, INFINITY);
        hasCycle = false;
        IntDeque q = new IntDeque();

        dist[src] = 0;
        q.add(src);
        for (int i = 0; i < g.vertexCount - 1; i++) {
            for (int v: q) {
                queued[v] = false;
            }
            int size = q.size();
            for (int s = 0; s < size; s++) {
                int u = q.poll();
                for (int edge: g.edges[u]) {
                    int v = g.to.get(edge);
                    if (dist[v] > dist[u] + g.cost.get(edge)) {
                        dist[v] = dist[u] + g.cost.get(edge);
                        prev[v] = u;
                        if (!queued[v]) {
                            queued[v] = true;
                            q.add(v);
                        }
                    }
                }
            }
        }

        CycleCheck: for (int u = 0; u < g.vertexCount; u++) {
            if (dist[u] == INFINITY) {
                continue;
            }
            for (int edge: g.edges[u]) {
                int v = g.to.get(edge);
                if (dist[v] > dist[u] + g.cost.get(edge)) {
                    prev[v] = u;
                    cycleStart = v;
                    hasCycle = true;
                    break CycleCheck;
                }
            }
        }
        return dist;
    }
    public int[] cycleVertices() {
        Arrays.fill(queued, false);
        IntDeque stk = new IntDeque();
        IntDeque q = new IntDeque();
        int v = cycleStart;
        while (!queued[v]) {
            queued[v] = true;
            stk.push(v);
            v = prev[v];
        }
        q.add(v);
        while (stk.peek() != v) {
            q.add(stk.pop());
        }
        return q.toArray();
    }
}

class IntArrayList {
    int size = 0;
    int[] array;
    public IntArrayList() {
        this(16);
    }
    public IntArrayList(int length) {
        array = new int[length];
    }
    public void ensureCapacity() {
        if (size == array.length) {
            int[] newArray = new int[size << 1];
            System.arraycopy(array, 0, newArray, 0, size);
            array = newArray;
        }
    }
    public void add(int element) {
        ensureCapacity();
        array[size] = element;
        size++;
    }
    private void checkIndex(int index) {
        if (index < 0 || index >= size) {
            throw new IndexOutOfBoundsException();
        }
    }
    public int get(int index) {
        checkIndex(index);
        return array[index];
    }
    }

class IntDeque implements Iterable<Integer> {

    private int capacity;
    private int size = 0;
    private int front = 0;
    private int back = 0;
    private int[] deque;
    public IntDeque() {
        this(100);
    }
    public IntDeque(int capacity) {
        this.capacity = capacity;
        deque = new int[capacity];
    }
    public void add(int x) {
        addLast(x);
    }
    public void addLast(int x) {
        ensureCapacity();
        size++;
        deque[back++] = x;
        if (back == capacity) {
            back = 0;
        }
    }
    public void addFirst(int x) {
        ensureCapacity();
        size++;
        if (front == 0) {
            front = capacity;
        }
        deque[--front] = x;
    }
    public void ensureCapacity() {
        if (size < capacity) {
            return;
        }
        int[] newDeque = new int[capacity << 1];
        for (int i = 0, j = front; i < size; i++, j++) {
            if (j == capacity) {
                j = 0;
            }
            newDeque[i] = deque[j];
        }
        deque = newDeque;
        capacity <<= 1;
        front = 0;
        back = size;
    }
    public Iterator<Integer> iterator() {
        return new Iterator<Integer>() {
            int done = 0;
            int curr = front;
            public boolean hasNext() {
                return done < size;
            }
            public Integer next() {
                Integer res = deque[curr++];
                if (curr == capacity) {
                    curr = 0;
                }
                done++;
                return res;
            }
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
    public int peek() {
        return peekFirst();
    }
    public int peekFirst() {
        return deque[front];
    }
    public int poll() {
        return pollFirst();
    }
    public int pollFirst() {
        if (size == 0) {
            throw new RuntimeException("IntDeque is empty!");
        }
        size--;
        int res = deque[front++];
        if (front == capacity) {
            front = 0;
        }
        return res;
    }
    public int pop() {
        return pollFirst();
    }
    public void push(int x) {
        addFirst(x);
    }
    public int size() {
        return size;
    }
    public int[] toArray() {
        int[] res = new int[size];
        for (int i = 0, j = front; i < size; i++, j++) {
            if (j == capacity) {
                j = 0;
            }
            res[i] = deque[j];
        }
        return res;
    }
    public String toString() {
        if (size == 0) {
            return "";
        }
        StringBuilder res = new StringBuilder();
        for (int i: this) {
            res.append(i);
            res.append(" ");
        }
        res.setLength(res.length() - 1);
        return res.toString();
    }
}

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		B solver = new B();
		solver.solve(1, in, out);
		out.close();
	}
}

class B {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        long a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        long c = in.nextInt();
        int[] to = new int[w];
        int[] cost = new int[w];
        Graph g = new Graph(w, w);
        for (int i = w - 1, j = i - x; i >= 0; i--, j = j == 0 ? w - 1 : j - 1) {
//            System.err.println(i + " to " + j);
            cost[i] = i > j ? 0 : -1;
            to[i] = j;
            g.addDirectedWeightedEdge(i, j, cost[i]);
        }
        BellmanFord bf = new BellmanFord(g);
        bf.getDist(b);
        long moves = 0;
//        System.err.println("Cycle start: " + bf.cycleStart);
        int extra = 0;
        while (b != bf.cycleStart && c > a) {
            extra++;
//            System.err.println("At " + b + " with curr A of " + a);
            a += cost[b];
            b = to[b];
            c--;
            moves++;
        }
//        System.err.println("Extra: " + extra);
        if (c <= a) {
            out.println(moves);
            return;
        }
        int cycleCost = 0;
        int cycleLength = 0;
        int curr = b;
        do {
            cycleLength++;
            if (curr < to[curr]) {
                cycleCost++;
            }
            curr = to[curr];
        } while (curr != b);
//        System.err.println("Length: " + cycleLength + " Cost: " + cycleCost);
        long cycles = 0;
        for (int i = 50; i >= 0; i--) {
            long aDiff = cycleCost * (1L << i);
            long cDiff = cycleLength * (1L << i);
            if (a - aDiff < c - cDiff) {
                a -= aDiff;
                c -= cDiff;
                cycles += 1L << i;
            }
        }
//        System.err.println("Cycles: " + cycles);
        extra = 0;
        moves += cycles * cycleLength;
        while (c > a) {
            extra++;
//            System.err.println("At " + b + " with curr A of " + a);
            a += cost[b];
            b = to[b];
            c--;
            moves++;
        }
//        System.err.println("Extra: " + extra);
        out.println(moves);
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class Graph {

    public IntArrayList to;
    public IntArrayList capacity;
    public IntArrayList cost;
    public IntArrayList reverse;
    public IntDeque edges[];
    public int vertexCount;
    public int edgeCount;
    public int inDegree[];
    public int outDegree[];

    public Graph(int vertexCount) {
        this(vertexCount, 16);
    }

    public Graph(int vertexCount, int edgeCount) {
        this.to = new IntArrayList(edgeCount);
        this.capacity = new IntArrayList(edgeCount);
        this.cost = new IntArrayList(edgeCount);
        this.reverse = new IntArrayList(edgeCount);
        this.edges = new IntDeque[vertexCount];
        this.vertexCount = vertexCount;
        this.edgeCount = 0;
        this.inDegree = new int[vertexCount];
        this.outDegree = new int[vertexCount];
        for (int i = 0; i < vertexCount; i++) {
            edges[i] = new IntDeque();
        }
    }

    public void addDirectedWeightedEdge(int u, int v, int edgeCost) {
        to.add(v);
        capacity.add(0);
        cost.add(edgeCost);
        reverse.add(-1);
        edges[u].add(edgeCount++);
        inDegree[v]++;
        outDegree[u]++;
    }

    }

class BellmanFord {

    public final long INFINITY = Long.MAX_VALUE;
    public long[] dist;
    public int[] prev;
    boolean[] enqueued;
    public boolean hasCycle;
    public int cycleStart;
    Graph g;

    public BellmanFord(Graph g) {
        dist = new long[g.vertexCount];
        prev = new int[g.vertexCount];
        enqueued = new boolean[g.vertexCount];
        this.g = g;
    }
    public long[] getDist(int src) {
        Arrays.fill(dist, INFINITY);
        hasCycle = false;
        IntDeque q = new IntDeque();

        dist[src] = 0;
        q.add(src);
        for (int i = 0; i < g.vertexCount - 1; i++) {
            for (int v: q) {
                enqueued[v] = false;
            }
            int size = q.size();
            for (int s = 0; s < size; s++) {
                int u = q.poll();
                for (int edge: g.edges[u]) {
                    int v = g.to.get(edge);
                    if (dist[v] > dist[u] + g.cost.get(edge)) {
                        dist[v] = dist[u] + g.cost.get(edge);
                        prev[v] = u;
                        if (!enqueued[v]) {
                            enqueued[v] = true;
                            q.add(v);
                        }
                    }
                }
            }
        }

        CycleCheck: for (int u = 0; u < g.vertexCount; u++) {
            if (dist[u] == INFINITY) {
                continue;
            }
            for (int edge: g.edges[u]) {
                int v = g.to.get(edge);
                if (dist[v] > dist[u] + g.cost.get(edge)) {
                    cycleStart = v;
                    hasCycle = true;
                    break CycleCheck;
                }
            }
        }
        return dist;
    }

}

class IntArrayList {
    int size = 0;
    int[] array;
    public IntArrayList() {
        this(16);
    }
    public IntArrayList(int length) {
        array = new int[length];
    }
    public void ensureCapacity() {
        if (size == array.length) {
            int[] newArray = new int[size << 1];
            System.arraycopy(array, 0, newArray, 0, size);
            array = newArray;
        }
    }
    public void add(int element) {
        ensureCapacity();
        array[size] = element;
        size++;
    }
    private void checkIndex(int index) {
        if (index < 0 || index >= size) {
            throw new IndexOutOfBoundsException();
        }
    }
    public int get(int index) {
        checkIndex(index);
        return array[index];
    }
    }

class IntDeque implements Iterable<Integer> {

    private int capacity;
    private int size = 0;
    private int front = 0;
    private int back = 0;
    private int[] deque;
    public IntDeque() {
        this(100);
    }
    public IntDeque(int capacity) {
        this.capacity = capacity;
        deque = new int[capacity];
    }
    public void add(int x) {
        addLast(x);
    }
    public void addLast(int x) {
        ensureCapacity();
        size++;
        deque[back++] = x;
        if (back == capacity) {
            back = 0;
        }
    }
    public void ensureCapacity() {
        if (size < capacity) {
            return;
        }
        int[] newDeque = new int[capacity << 1];
        for (int i = 0, j = front; i < size; i++, j++) {
            if (j == capacity) {
                j = 0;
            }
            newDeque[i] = deque[j];
        }
        deque = newDeque;
        capacity <<= 1;
        front = 0;
        back = size;
    }
    public Iterator<Integer> iterator() {
        return new Iterator<Integer>() {
            int done = 0;
            int curr = front;
            public boolean hasNext() {
                return done < size;
            }
            public Integer next() {
                Integer res = deque[curr++];
                if (curr == capacity) {
                    curr = 0;
                }
                done++;
                return res;
            }
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
    public int poll() {
        return pollFirst();
    }
    public int pollFirst() {
        if (size == 0) {
            throw new RuntimeException("IntDeque is empty!");
        }
        size--;
        int res = deque[front++];
        if (front == capacity) {
            front = 0;
        }
        return res;
    }
    public int size() {
        return size;
    }
    public String toString() {
        if (size == 0) {
            return "";
        }
        StringBuilder res = new StringBuilder();
        for (int i: this) {
            res.append(i);
            res.append(" ");
        }
        res.setLength(res.length() - 1);
        return res.toString();
    }
}

import java.io.*;
import java.util.*;

public class CF224B {

	private static BufferedReader	br;
	private static StringTokenizer 	st;
	private static PrintWriter 		pw;
	// private static Timer t = new Timer();

	public CF224B() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
	}

	String next() throws IOException {
        while (st == null || !st.hasMoreElements())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    boolean hasNext() {
        if (st != null && st.hasMoreElements())
            return true;

        try {
            while (st == null || !st.hasMoreElements())
                st = new StringTokenizer(br.readLine());
        }
        catch (Exception e) {
            return false;
        }

        return true;
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

	void solve() throws IOException {
		long a = nextLong(), b = nextLong(), w = nextLong(), x = nextLong(), c = nextLong();
		long n = ((c-a) * w - b + w - x - 1)/ (w-x);
		pw.println(Math.max(0, n));
		pw.flush();
	}

	public static void main(String[] args) throws IOException{
		 new CF224B().solve();
	 }
}

		import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

		public class B {
			public static void main(String[] args)throws Exception {
				FastScanner sc = new FastScanner(System.in);
				long A = sc.nextLong(),B = sc.nextLong(), W = sc.nextLong(), X = sc.nextLong(), C = sc.nextLong();
				long K=(long)Math.ceil(((C-A+0.0)*X-B)/(W-X));
				System.out.println((Math.max(0, (long)Math.ceil(C-A+K))));

			}

		static class FastScanner {
				BufferedReader br;
				StringTokenizer st;

				public FastScanner(InputStream in) throws Exception{
					br = new BufferedReader(new InputStreamReader(in));
					st = new StringTokenizer(br.readLine().trim());
				}
				public int numTokens() throws Exception {
					if(!st.hasMoreTokens()){
						st = new StringTokenizer(br.readLine().trim());
						return numTokens();
					}
					return st.countTokens();
				}
				public boolean hasNext() throws Exception{
					if(!st.hasMoreTokens()){
						st = new StringTokenizer(br.readLine().trim());
						return hasNext();
					}
					return true;
				}
				public String next() throws Exception {
					if(!st.hasMoreTokens()){
						st = new StringTokenizer(br.readLine().trim());
						return next();
					}
					return st.nextToken();
				}
				public double nextDouble() throws Exception{
					return Double.parseDouble(next());
				}
				public float nextFloat() throws Exception{
					return Float.parseFloat(next());
				}
				public long nextLong() throws Exception{
					return Long.parseLong(next());
				}
				public int nextInt() throws Exception{
					return Integer.parseInt(next());
				}
				public String nextLine() throws Exception{
					return br.readLine().trim();
				}
			}

		}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class NumberBusters {

    public static void main(String[]args) throws IOException{

while(true){

    if(!skp())break;

    int a = nextInt();
    int b = nextInt();
    int w = nextInt();
    int x = nextInt();
    int c = nextInt();

    long hi = (long) 10E18;
    long lo = 0 ;
    for(int i = 0 ; i < 170 ; i++){

    long mid = lo + (hi-lo)/2;
    long a1 = a-    (long) Math.ceil((b-mid*x)/(w*-1.0));
        long c1= c-mid;
        if(c1<=a1)hi = mid;
        else lo = mid+1;

    }

    System.out.println(lo);

}

        }

    static boolean skp() throws IOException{
        String line = r.readLine();
        if(line == null)return false;
        tkn = new StringTokenizer(line);
        return true;
    }

    static int nextInt(){
        return Integer.parseInt(tkn.nextToken());
    }
    static int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(r.readLine());
    }
    static long nextLong(){
        return Long.parseLong(tkn.nextToken());
    }
    static long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(r.readLine());
    }

    static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tkn ;

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class B {

	static PrintWriter out;
	static InputReader in;
	public static void main(String[] args) throws Exception {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);

		long a = in.nextLong();
		long b = in.nextLong();
		long w = in.nextLong();
		long x = in.nextLong();
		long c = in.nextLong();

		if(c <= a){
			out.println(0);
			out.close();
			return;
		}
		// search last highest c > a
		long lo = 0;
		long hi = Long.MAX_VALUE/2 / 1000;
		while(lo < hi) {
			long mid = (lo+hi+1)/2;
			long newc = c - mid;

			// b - mid * x, need how many + w to be >= 0?
			long need = 0;
			if(b - mid * x >= 0) {
				need = 0;
			} else {
				need = - (b - mid * x) / w;
				while(b - mid * x + need  * w < 0){
					need++;
				}

				while(b - mid * x + need  * w >= w){
					need--;
				}
			}
			long newa = a - need;
			if(newc > newa){
				lo = mid;
			}else{
				hi = mid-1;
			}
		}
		out.println(lo+1);
		out.close();
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.util.*;
public class Ganesha {

  public static void main (String [] args){

  	Scanner in = new Scanner(System.in);

  	 long a = in.nextLong();
  	 long b = in.nextLong();
  	 long w = in.nextLong();
  	 long x = in.nextLong();
  	 long c = in.nextLong();
  	  w=w-x;

  	 if(c<=a)
  	 	System.out.print("0");

  	 	else if(c>a){
  	 		if(b>=(c-a)*x)
  	 			System.out.print((c-a));

  	 			else{
  	 			  if(((c-a)*x-b)%w==0)
  	 			 System.out.print((c-a)+(((c-a)*x-b)/w));

  	 			  else{
  	 			  	 System.out.print((c-a+1)+(((c-a)*x-b)/w));
  	 			  }
  	 			}

  	 	}
  }
  }

import java.util.*;
public class Ganesha {

  public static void main (String [] args){

  	Scanner in = new Scanner(System.in);

  	 long a = in.nextLong();
  	 long b = in.nextLong();
  	 long w = in.nextLong();
  	 long x = in.nextLong();
  	 long c = in.nextLong();
  	  w=w-x;

  	 if(c<=a)
  	 	System.out.print("0");

  	 	else if(c>a){
  	 		if(b>=(c-a)*x)
  	 			System.out.print((c-a));

  	 			else{
                    System.out.print((long)(c-a +Math.ceil((double)(((c-a)*x-b))/w)));

  	 			}

  	 	}
  }
  }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CopyOfSolution {

    public static void main(String[] args) throws NumberFormatException, IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        InputReader in = new InputReader(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();
        long steps = Math.max((((long) w * (c - a)) - b + w - x - 1) / (w - x), 0);

        // AP select min, distinct, sorted, half might not be possible, half unique
        // Equation minimize, assume steps, ceil + den-1, steps negative not possible - take max 0
        out.println(steps);
        // int n = in.nextInt();
        // int[] arr = new int[n];
        // for (int i = 0; i < n; i++) {
        // arr[i] = in.nextInt();
        // }
        // Arrays.sort(arr);
        // Set<Integer> s = new TreeSet<>();
        // if (arr.length == 1) {
        // out.println(-1);
        // } else if (arr.length == 2) {
        // int d = arr[1] - arr[0];
        // s.add(arr[0] - d);
        // if (((arr[0] + arr[1]) & 1) != 1)
        // s.add(((arr[0] + arr[1]) >> 1));
        // s.add(arr[1] + d);
        // out.println(s.size());
        // for (Integer k : s) {
        // out.print(k + " ");
        // }
        // out.println();
        // } else {
        // int c = 0;
        // int num = 0;
        // int actual = Math.min(arr[1] - arr[0], arr[2] - arr[1]);
        // for (int i = 0; i < arr.length - 1; i++) {
        // int now = arr[i + 1] - arr[i];
        // if (actual != now) {
        // if (now == 2 * actual) {
        // num = (arr[i + 1] + arr[i]) >> 1;
        // if (((arr[i + 1] + arr[i]) & 1) == 1)
        // c = 100;
        // c++;
        // } else {
        // c = 100;
        // break;
        // }
        // }
        // }
        // if (c == 0) {
        // if (arr[0] - actual != arr[arr.length - 1] + actual) {
        // out.println(2);
        // out.println((arr[0] - actual) + " " + (arr[arr.length - 1] + actual));
        // } else {
        // out.println(1);
        // out.println(arr[0] - actual);
        // }
        // } else if (c == 1) {
        // out.println(1);
        // out.println(num);
        // } else {
        // out.println(0);
        // }
        // }
        out.close();
    }

    private static long next(long m) {
        // TODO Auto-generated method stub
        long dig = func(m);
        long next = 1;
        for (int i = 0; i < dig; i++) {
            next *= 10;
        }
        return next;
    }

    private static long func(long m) {
        int c = 1;
        while (m >= 10) {
            m /= 10;
            c++;
        }
        return c;
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int _a, _b, _w, _x, _c;

    public static void main(String[] args) {
        NumberBusters busters = new NumberBusters();
        busters.read();
        busters.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] s = br.readLine().split(" ");
            this._a = Integer.parseInt(s[0]);
            this._b = Integer.parseInt(s[1]);
            this._w = Integer.parseInt(s[2]);
            this._x = Integer.parseInt(s[3]);
            this._c = Integer.parseInt(s[4]);
        } catch (Exception e) {
        }

    }

    void solve() {
        if (_c <= _a) {
            System.out.println(0);
            return;
        }

        long times = 0;
        int a = _a;
        int b = _b;
        int prevB = b;
        int c = _c;
        int cntA = 0;
        do {
            times++;
            c--;

            if (b >= _x) {
                b = b - _x;
            } else {
                cntA++;
                a--;

                b = _w - (_x - b);
            }
//          System.out.println("c:" + c + " a:" + a);
        } while (c > a && b != prevB);

        if (c <= a) {
            System.out.println(times);
        } else {
            long diff = times - cntA;
            long num = (c - a - 1) / diff;
//          System.out.println("dif:" + diff + " c - a:" + (c - a));
//          System.out.println("\ttimes" + times);
            c -= num * times;
            a -= num * cntA;
            times += num * times;
            while (c > a) {
//          System.out.println("c:" + c + " a:" + a);
                times++;
                c--;

                if (b >= _x) {
                    b = b - _x;
                } else {
                    a--;

                    b = _w - (_x - b);
                }
            }

            System.out.println(times);
        }

        return;
    }
}

import java.util.*;

import java.io.*;
public class Test {

	public static void main(String[] args) throws Exception{
		  Scanner aa = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
	      long a,b,x,w,c;
	      a=aa.nextLong();
	      b=aa.nextLong();
	      w=aa.nextLong();
	      x=aa.nextLong();
	      c=aa.nextLong();
	      long count=0;
	      if(b/x<c-a){
	      count = ((c-a)*x-b)/(w-x);
	      if(((c-a)*x-b)%(w-x)!=0)count++;
	      }
	      count+=c-a;
	      System.out.println(count);
	}
}

import java.text.DateFormat;
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;

import static java.lang.Math.*;

public class solver {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    String readString() throws IOException{
        while (tok==null || !tok.hasMoreTokens()){
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return null;
            }

        }
        return tok.nextToken();
    }
    int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(readString());
    }
    long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(readString());
    }
    double readDouble() throws NumberFormatException, IOException{
        return Double.parseDouble(readString());
    }

    final static boolean OJ=System.getProperty("ONLINE_JUDGE")!=null;

    void init() throws FileNotFoundException{
        if (OJ){
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);
        }else{
            in=new BufferedReader(new FileReader("input.txt"));
            out=new PrintWriter("output.txt");
        }
    }
    int[] iMas(int n) throws NumberFormatException, IOException{
        int[] a=new int[n];
        for (int i=0;i<n;i++){
            a[i]=readInt();
        }
        return a;
    }

    int gcd(int a,int b){
        return (b==0)?a:gcd(b,a%b);
    }

    void solve() throws IOException{
        long a=readInt();
        int b=readInt();
        int w=readInt();
        int x=readInt();
        long c=readInt();
        int[] z=new int[2000];
        int[] k=new int[2000];
        Arrays.fill(z, -1);
        z[b]=0;
        int bb=b;
        int index=0;

        int kolx=0;
        int koly=0;

        while (true){
            int old=bb;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                p=true;
                bb+=w;
            }
            boolean pp=false;
            if (z[bb]!=-1){
                kolx=k[old]+1-k[bb];
                koly=z[old]+((p)?1:0)-z[bb];

                index=bb;
                break;
            }
            if (z[bb]==-1){
                z[bb]=0;
            }
            k[bb]=k[old]+1;
            if (p) z[bb]=z[old]+1;else z[bb]=z[old];

        }
        long answer=0;
        bb=b;
        while (bb!=index){
            if (c<=a){
                out.println(answer);
                return;
            }
            answer++;
            c--;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                bb+=w;
                a--;
            }
        }
        int l=0;
        int r=2*(int)1e9;
        int ans=0;
        while (l<=r){
            int mid=l+(r-l)/2;
            if (c-(long)mid*kolx>=a-(long)mid*koly){
                ans=mid;
                l=mid+1;
            }else{
                r=mid-1;
            }
        }
        ans--;
        if (ans!=-1){
            c-=(long)ans*kolx;
            a-=(long)ans*koly;
            answer+=(long)ans*kolx;
        }

//      while (true){
//          if (kolx==0 && koly==0) break;
//          if (c-kolx<=a-koly) break;
//          c-=kolx;
//          answer+=kolx;
//          a-=koly;
//      }

        bb=index;
        while (true){
            if (c<=a){
                out.println(answer);
                return;
            }
            answer++;
            c--;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                bb+=w;
                a--;
            }
        }

    }

    void run() throws NumberFormatException, IOException{
        init();
        long h=System.currentTimeMillis();
        solve();
        System.err.println(System.currentTimeMillis()-h);
        out.close();
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        new solver().run();
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vadim Semenov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextLong();
        long b = in.nextLong();
        long w = in.nextLong();
        long x = in.nextLong();
        long c = in.nextLong();
        /*long left = -1;
        long right = 1000L * Integer.MAX_VALUE;
        while (right - left > 1) {
            long mid = (right + left) >> 1;
            if (mid * (w - x) + b - w * (c - a) >= 0) {
//                System.err.println(mid * (w - x) + b - w * (c - a));
                right = mid;
            } else {
                left = mid;
            }
        }*/
        if (c <= a) out.println(0);
        else out.println((w * (c - a + 1) - b - x - 1) / (w - x));
//        out.println(right);
    }
}

class InputReader {
    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String next() {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		long a = ni();
		int b = ni();
		int w = ni();
		int x = ni();
		long c = ni();
		int step = 45000;

		int[] move_b = new int[w];
		for (int i = 0; i < w; i++)
			move_b[i] = i;
		int[] next_move = new int[w];

		int[] dif_b = new int[w];
		int[] next_dif = new int[w];

		for (int move = 1; move <= step; move++) {
			for (int bb = 0; bb < w; bb++) {
				int prev_b = move_b[bb];
				int prev_dif = dif_b[bb];

				if (prev_b >= x) {
					next_move[bb] = prev_b - x;
					next_dif[bb] = prev_dif;
				} else {
					next_move[bb] = w - (x - prev_b);
					next_dif[bb] = prev_dif + 1;
				}

			}
			int[] t = dif_b;
			dif_b = next_dif;
			next_dif = t;
			Arrays.fill(next_dif, 0);

			int[] t2 = move_b;
			move_b = next_move;
			next_move = t2;
			Arrays.fill(next_move, 0);

		}
		long t = 0;
		while (true) {
			long next_c = c -(long)step;
			long next_a = a - dif_b[b];
			if(next_c <= next_a)
				break;

			a -= dif_b[b];
			b = move_b[b];
			t += (long)step;
			c -= (long)step;

		}
		while (c > a) {
			c--;
			if (b < x)
				a--;
			if (b >= x) {
				b = b - x;
			} else {
				b = w - (x - b);
			}
			t++;
		}

		return t;
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Runtime O(logN)
 *
 * @author Don Li
 */
public class NumberBusters4 {
    void solve() {
        long a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();

        long t = w - b - 1;

        long lb = -1, ub = (long) 2e13;
        while (ub - lb > 1) {
            long k = (lb + ub) >> 1;
            long na = a - (t + k * x) / w, nc = c - k;
            if (nc <= na) ub = k;
            else lb = k;
        }
        out.println(ub);
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NumberBusters4().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Árysson Cavalcanti
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int a=in.readInt(), b=in.readInt(), w=in.readInt(), x=in.readInt(), c=in.readInt(), dif=c-a;
        if (c<=a) {
            out.printLine(0);
            return;
        }
        IntPair pair=f(a, b, w, x);
        //if (a==1) out.printLine(pair);
        long ret=0;
        if (dif>pair.first) {
            if (dif%pair.first==0) {
                ret+=1L*(dif/pair.first-1)*pair.second;
                dif=pair.first;
            } else {
                ret+=1L*dif/pair.first*pair.second;
                dif%=pair.first;
            }
        }
        if (dif>pair.first) dif%=pair.first;
        while (dif>0) {
            if (b>=x) {
                b-=x;
                dif--;
            } else b+=w-x;
            ret++;
        }
        out.printLine(ret);
    }

    IntPair f(int a, int b, int w, int x) {
        int nb=b, na=a, t=0;
        do {
            if (nb>=x) nb-=x;
            else  {
                na--;
                nb+=w-x;
            }
            t++;
        } while (nb!=b);
        return new IntPair(t-a+na, t);
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void close() {
        writer.close();
    }

    public void printLine(long i) {
        writer.println(i);
    }

    public void printLine(int i) {
        writer.println(i);
    }
}

class IntPair implements Comparable<IntPair> {
    public final int first, second;

    public IntPair(int first, int second) {
        this.first = first;
        this.second = second;
    }

    public String toString() {
        return "(" + first + "," + second + ")";
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        IntPair intPair = (IntPair) o;

        return first == intPair.first && second == intPair.second;

    }

    public int hashCode() {
        int result = first;
        result = 31 * result + second;
        return result;
    }

    public int compareTo(IntPair o) {
        if (first < o.first)
            return -1;
        if (first > o.first)
            return 1;
        if (second < o.second)
            return -1;
        if (second > o.second)
            return 1;
        return 0;
    }
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Alex
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out){
	    long a = in.readLong(), b = in.readLong(), w = in.readLong(), x = in.readLong(), c = in.readLong();
	    w -= x;
	    long min = 0, max = (long) 1e14;
	    while(min < max){
		    long avg = (min + max) / 2;
		    if (works(avg, a, b, c, w, x)) max = avg;
		    else min = avg + 1;
	    }
	    out.printLine(min);
}
	boolean works(long val, long a, long b, long c, long w, long x){
		long cres = c - val;
		long amin = cres;
		long maxasubtract = a - amin;
		if(maxasubtract < 0) return false;
		long bsubtract = val - maxasubtract;
		long bres = b + maxasubtract * w - x * bsubtract;
		return bres >= 0;
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public void close() {
		writer.close();
	}
	public void printLine(long i) {
		writer.println(i);
	}
}

import java.util.*;
import java.io.*;

public class B
{

    Reader in;
    PrintWriter out;
    int i = 0, j = 0;
    void solve()
    {

        //START//
        long a = in.nextLong(), b = in.nextLong(), w = in.nextLong(), x = in.nextLong(), c = in.nextLong();
        if (c <= a)
        {
            out.println("0");
            return;
        }
        long steps = 1;
        long A = a;
        long B = b;
        long C = c;
        c--;
        if (b >= x)
        {
            b = b - x;
            if (c <= a)
            {
                out.println(steps);
                return;
            }
        }
        else
        {
            a--;
            b = w - (x-b);
        }
        while (b != B)
        {
            steps++;
            c--;
            if (b >= x)
            {
                b = b - x;
                if (c == a)
                {
                    out.println(steps);
                    return;
                }
            }
            else
            {
                a--;
                b = w - (x-b);
            }

        }
        long gained = (C-A)-(c-a);
        long needed = (C-A)/gained;
        C -= (gained*needed);
        if (C <= A)
        {
            C += gained;
            needed--;

        }
        steps *= needed;

        if (C > A)
        {
            a = A;
            c = C;
            while (a < c)
            {
                steps++;
                c--;
                if (b >= x)
                {
                    b = b - x;
                    if (c == a)
                    {
                        out.println(steps);
                        return;
                    }
                }
                else
                {
                    a--;
                    b = w - (x-b);
                }

            }
        }
        else
        {
            out.println(steps);
        }

        //END

    }
    void runIO()
    {
        in = new Reader();
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

    public static void main(String[] args)
    {
        new B().runIO();
    }

    // input/output
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);

            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public final String next()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do
            {
                res.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int nextInt()
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong()
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble()
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        public int[] readIntArray(int size)
        {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++)
                arr[i] = nextInt();
            return arr;
        }

        public long[] readLongArray(int size)
        {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++)
                arr[i] = nextInt();
            return arr;
        }

        private void fillBuffer()
        {
            try
            {
                bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            }
            catch (IOException e)
            {

            }

            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read()
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
    }
}

import javafx.util.Pair;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        ConsoleIO io = new ConsoleIO();
        new Main(io).solve();
        io.flush();
    }
    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }

    public void solve() {
        int[] l = io.readIntArray();
        long a = l[0], b = l[1], w = l[2], x = l[3], c = l[4];
        long left = 0;
        long right = c * 10000;
        while (left < right) {
            long mid = (left + right) / 2;
            if (a - (w - b - 1 + mid * x) / w < c - mid) left = mid + 1;
            else right = mid;
        }
        io.writeLine("" + left);
    }

}

class ConsoleIO {
    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}
    public void flush(){
        this.out.close();
    }
    public void writeLine(String s) {
        this.out.println(s);
    }
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long readLong() {
        return Long.parseLong(this.readLine());
    }
    public int readInt() {
        return Integer.parseInt(this.readLine());
    }
    public int[] readIntArray() {
        String[]n=this.readLine().split(" ");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 * @author pttrung
 */
public class B_Round_224_Div2 {

    public static long MOD = 1000000007;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        int a= in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();
        if(c <= a){
        	out.println(0);
        }else{

        	long dif = c - a;
        	long []step = new long[w + 1];
        	long[] d = new long[w + 1];
        	Arrays.fill(step, -1);
        	step[b] = 0;
        	d[b] = dif;
        	long cur = 0;
        	while(true){
        		//System.out.println(b);
        		if(b >= x){
        			int num = b/x;
        			if(dif > num){
        				dif -= num;
        				cur += num;
        				b = b % x;

        			}else{
        				cur += dif;
        				break;
        			}
        		}else {
        			b = w - (x - b);

        			cur++;
        		}
        		if(step[b] != -1){

					long n = d[b] - dif;
					long l = cur - step[b];
					long v = dif / n;
					if(v > 1){
						v--;
						cur += l*v;
						dif = n + dif % n;
					}

				}else{
					step[b] = cur;
					d[b] = dif;

				}
        	}
        	out.println(cur);
        }

        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _382B solver = new _382B();
        solver.solve(1, in, out);
        out.close();
    }

    static class _382B {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int w = in.nextInt();
            int x = in.nextInt();

            int c = in.nextInt();

            if (c <= a) {
                out.println(0);
                return;
            }

            int[] step = new int[w];
            int[] ad = new int[w];

            Arrays.fill(step, -1);
            step[b] = 0;

            int cp = -1;
            int cl = -1;
            int fad = -1;
            int t = 1;
            while (true) {
                if (b >= x) {
                    b = b - x;
                    if (step[b] != -1) {
                        cp = b;
                        cl = t - step[b];
                        fad = ad[b + x] - ad[b];
                        break;
                    } else {
                        step[b] = t;
                        ad[b] = ad[b + x];
                    }
                } else {
                    int nb = w - (x - b);

                    if (step[nb] != -1) {
                        cp = nb;
                        cl = t - step[nb];
                        fad = ad[b] + 1 - ad[nb];
                        break;
                    } else {
                        step[nb] = t;
                        ad[nb] = ad[b] + 1;
                    }

                    b = nb;
                }
                t++;
            }

            long ct = 0;
            if (cp != b) {
                if (c - step[cp] <= a) {
                    out.println(simul(a, b, w, x, c));
                    return;
                }
                a -= ad[cp];
                ct += step[cp];
                c -= step[cp];
                b = cp;
            }

            if (a + cl + 1 >= c) {
                out.println(ct + simul(a, b, w, x, c));
                return;
            }

            long tot = (c - (a + cl + 1)) / (cl - fad);

            ct += tot * cl;
            a -= tot * fad;
            c -= tot * cl;

            out.println(ct + simul(a, b, w, x, c));
        }

        int simul(int a, int b, int w, int x, int c) {
            int ct = 0;
            while (c > a) {
                if (b >= x) {
                    b = b - x;
                } else {
                    b = w - (x - b);
                    a = a - 1;
                }
                ct++;
                c--;
            }

            return ct;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _382B solver = new _382B();
        solver.solve(1, in, out);
        out.close();
    }

    static class _382B {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int w = in.nextInt();
            int x = in.nextInt();

            int c = in.nextInt();

            if (c <= a) {
                out.println(0);
                return;
            }

            int[] step = new int[w];
            int[] ad = new int[w];

            Arrays.fill(step, -1);
            step[b] = 0;

            int cp = -1;
            int cl = -1;
            int fad = -1;
            int t = 1;
            while (true) {
                if (b >= x) {
                    b = b - x;
                    if (step[b] != -1) {
                        cp = b;
                        cl = t - step[b];
                        fad = ad[b + x] - ad[b];
                        break;
                    } else {
                        step[b] = t;
                        ad[b] = ad[b + x];
                    }
                } else {
                    int nb = w - (x - b);

                    if (step[nb] != -1) {
                        cp = nb;
                        cl = t - step[nb];
                        fad = ad[b] + 1 - ad[nb];
                        break;
                    } else {
                        step[nb] = t;
                        ad[nb] = ad[b] + 1;
                    }

                    b = nb;
                }
                t++;
            }

            long ct = 0;
            if (cp != b) {
                if (c - step[cp] <= a - ad[cp]) {
                    out.println(simul(a, b, w, x, c));
                    return;
                }
                a -= ad[cp];
                ct += step[cp];
                c -= step[cp];
                b = cp;
            }

            if (a + cl + 1 >= c) {
                out.println(ct + simul(a, b, w, x, c));
                return;
            }

            long tot = (c - (a + cl + 1)) / (cl - fad);

            ct += tot * cl;
            a -= tot * fad;
            c -= tot * cl;

            out.println(ct + simul(a, b, w, x, c));
        }

        int simul(int a, int b, int w, int x, int c) {
            int ct = 0;
            while (c > a) {
                if (b >= x) {
                    b = b - x;
                } else {
                    b = w - (x - b);
                    a = a - 1;
                }
                ct++;
                c--;
            }

            return ct;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    public void solve(Scanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();

        long time = 0;
        int d = c - a;
        int offset = b / x;
        if (d <= offset) {
            System.out.println(Math.max(0, d));
            return;
        }
        d -= offset;
        time = offset + 1;
        long curr = w - (x - b % x);
//        System.out.println(curr);
        long cycle = 0L;
        for (int i = 0; i < x; i++) {
            cycle += curr / x;
            curr = w - (x - curr % x);
//            System.out.println(curr);
        }
//        System.out.println(cycle);
        long cycleCount = Math.max(d / cycle - 1, 0);
        time += cycleCount * (cycle + x);
        d -= cycle * cycleCount;
        while (d > 0) {
            if (curr >= x) {
                curr = curr - x;
                --d;
            } else {
                curr = w - (x - curr);
            }
            ++time;
        }
        System.out.println(time);
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;
        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}

import java.util.Scanner;
public class Works {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        long c = in.nextInt();
        if (b >= 0 && b < w && x > 0 && x < w)
            if (c <= a) System.out.println(0);
            else  {
                long sec = (long)Math.ceil(1.0*((c - a) * x - b) / (w - x));
                System.out.println(sec + c - a);
            }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int a=in.nextInt();
		int b=in.nextInt();
		int w=in.nextInt();
		int x=in.nextInt();
		int c=in.nextInt();

		if(c<=a){
			out.println(0);
			return;
		}

		Result[] r=new Result[w+10];
		int[] mod=new int[w+10];
		Arrays.fill(mod, -1);
		r[0]=new Result(b, 0, 0);
		int loop_start=0;
		int index=1;
		for(index=1;;index++){
			Result re;
			if(b>=x){
				b-=x;
				re=new Result(b, index, r[index-1].total+1);
			}else{
				b=w+b-x;
				re=new Result(b, index, r[index-1].total);
			}
			if(mod[b]!=-1){
				loop_start=mod[b];
				break;
			}else{
				mod[b]=index;
				r[index]=re;
			}
		}

		int loop_cnt=index-loop_start;
		int total=r[index-1].total-r[loop_start-1].total;
		int total_start=r[loop_start].total;
		long ans=0;
		if(c-a<=r[loop_start-1].total){
			int tmp=loop_start-1;
			while(r[tmp].total>=(c-a)){
				tmp--;
			}
			ans=tmp++;
			out.println(ans);
			return;
		}
		c-=r[loop_start-1].total;
		ans+=loop_start-1;
		long t=(c-a)/total;
		long s=(c-a)%total;

		if(s==0){
			ans+=(t-1)*loop_cnt;
			int tmp=index-1;
			while(r[tmp].total==r[index-1].total){
				tmp--;
			}
			ans+=tmp+1;
		}else{
			ans+=t*loop_cnt;
			int tmp=loop_start;
			while(r[tmp].total-r[loop_start-1].total<s){
				tmp++;
			}
			ans+=tmp-loop_start+1;
		}

		out.println(ans);
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class B {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int MAX = 1000;
	public void solve() throws IOException {
		long A = nextInt();
		int B = nextInt();
		int W = nextInt();
		int X = nextInt();
		long C = nextInt();
		long OC = C;

		int[] rounds = new int[MAX+1];
		int[] nexts = new int[MAX+1];

		for (int b = 0; b <= MAX; b++) {
			if (b < X) {
				rounds[b] = 1;
			} else {
				rounds[b] = (b-X)/X + 1 + 1;
			}
			nexts[b] = W - (X - (b - (rounds[b]-1) * X));
//			System.out.println(b + ": " + rounds[b] + ": " + nexts[b]);
		}

		boolean jumped = false;
		long[][] reached = new long[MAX+1][];
		reached[B] = new long[] {C, A};

		while (C - rounds[B] > A - 1) {
			C -= rounds[B];
			A -= 1;

			if (jumped || reached[nexts[B]] == null) {
				reached[nexts[B]] = new long[] {C, A};
			} else {
				long gapC = reached[nexts[B]][0] - C;
				long gapA = reached[nexts[B]][1] - A;

				long jump = (C-1-A) / (gapC - gapA) - 1;
				if (C - jump * gapC > A - jump * gapA) {
					C -= jump * gapC;
					A -= jump * gapA;
				}
				jumped = true;
			}
			B = nexts[B];
		}

		while (C > A) {
			B -= X;
			C--;
		}

		out.println(OC - C);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new B().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Solver {

	public static void main(String[] Args) throws NumberFormatException,
			IOException {
		new Solver().Run();
	}

	PrintWriter pw;
	StringTokenizer Stok;
	BufferedReader br;

	public String nextToken() throws IOException {
		while (Stok == null || !Stok.hasMoreTokens()) {
			Stok = new StringTokenizer(br.readLine());
		}
		return Stok.nextToken();
	}

	public int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	public double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	public long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	long chis1, chis2;
	int factor;
	int w, x;
	int[] offset, factValue;

	long endSimulation(int curFact, long curStep, long chis1, long chis2){
		long result=curStep;
		while (chis1<chis2){
			chis2--;
			if (curFact>=x)
				curFact-=x;
			else
			{
				chis1--;
				curFact=w-(x-curFact);
			}
			result++;
		}
		return result;
	}

	public void Run() throws NumberFormatException, IOException {
		//br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter("output.txt");
		br=new BufferedReader(new InputStreamReader(System.in));  pw=new PrintWriter(new OutputStreamWriter(System.out));

		chis1=nextInt();
		factor=nextInt();
		w=nextInt();
		x=nextInt();
		chis2=nextInt();
		if (chis2-chis1<1000){
			pw.println(endSimulation(factor, 0, chis1, chis2));
			pw.flush();
			pw.close();
			return;
		}
		offset=new int[1001];
		factValue=new int[1001];
		offset[0]=0;
		factValue[0]=factor;
		for (int i=1; i<1001; i++){
			if (factValue[i-1]>=x)
			{
				factValue[i]=factValue[i-1]-x;
				offset[i]=offset[i-1];
			}
			else
			{
				offset[i]=offset[i-1]-1;
				factValue[i]=w-(x-factValue[i-1]);
			}
		}

		int periodLen=0;
		int periodOffset;
		int i=999;
		while (factValue[i]!=factValue[1000])
			i--;
		periodLen=1000-i;
		periodOffset=offset[1000]-offset[i];
		long kolStep=i;
		chis2-=kolStep;
		chis1+=offset[i];
		long kolPeriod=(chis2-chis1)/(periodLen+periodOffset)-1;
		kolStep+=kolPeriod*periodLen;
		chis2-=kolPeriod*periodLen;
		chis1+=periodOffset*kolPeriod;
		kolStep=endSimulation(factValue[i], kolStep, chis1, chis2);
		pw.println(kolStep);
		pw.flush();
		pw.close();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) throws IOException {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long a = scan.nextInt(), b = scan.nextInt(), w = scan.nextInt(), x = scan.nextInt(), c = scan.nextInt();
		b = w-b-1;
		long best = 0, l = 0, r = (long)1e18;
		while(l < r){
			long mid = (l+r)/2;
			long cura = a-(b+mid*x)/w;
			long curc = c-mid;
			if(curc <= cura){
				best = mid;
				r = mid;
			}
			else l = mid+1;
		}
		out.println(best);
		out.close();
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}

		public int[] nextArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}

}

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int a = sc.nextInt(), b = sc.nextInt(), w = sc.nextInt();
		int x = sc.nextInt(), c = sc.nextInt();

		ArrayList<Integer> ch = new ArrayList<>();
		boolean[] vis = new boolean[w + 1];
		int crossCount = 0;
		while(!vis[b])
		{
			ch.add(b);
			vis[b] = true;
			b -= x;
			if(b < 0) { ++crossCount; b += w; }
		}

		long ans = -1, lo = 0, hi = (long)1e16;
		while(lo <= hi)
		{
			long t = (lo + hi) / 2;
			long A = t / ch.size() * crossCount;
			long end = t % ch.size();
			for(int i = 0; i < end; ++i)
				if(ch.get(i) < x)
					++A;
			if(c - t <= a - A)
			{
				ans = t;
				hi = t - 1;
			}
			else
				lo = t + 1;
		}
		out.println(ans);
		out.close();
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader s) throws FileNotFoundException {	br = new BufferedReader(s);}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {

    public static Scanner cin = new Scanner(System.in);

    public static final int N = 150000;

    public static void main(String[] args) throws IOException  {
        //BufferedReader in = new BufferedReader(new FileReader(new File("D:/java.inp")));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String s = in.readLine();
        String[] st = s.split(" ");
        long a = Long.parseLong(st[0]);
        long b = Long.parseLong(st[1]);
        long w = Long.parseLong(st[2]);
        long x = Long.parseLong(st[3]);
        long c = Long.parseLong(st[4]);

        b = w-b-1;
        long l = 0, r = (long)1000000000000000l, res = 0;
        while (l <= r) {
            long mid = (l+r)/2;
            long aa = a-(b+mid*x)/w;
            long cc = c-mid;
            if (cc <= aa) {
                res = mid;
                r = mid-1;
            }
            else
                l = mid+1;
        }

        System.out.print(res);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class NumberBusters {

    int N = 1000;

    void solve() {
        int a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();

        if (c <= a) {
            out.println(0);
            return;
        }
        int delta = c - a;

        int repeat = getRepeatElement(b, w, x);
        int[] prev = getPreCount(b, w, x, repeat);
        if (delta <= prev[0]) {
            long ans = 0;
            while (c > a) {
                ans++;
                c--;
                if (b >= x) {
                    b -= x;
                } else {
                    a--;
                    b += w - x;
                }
            }
            out.println(ans);
            return;
        }

        long ans = prev[0] + prev[1];
        delta -= prev[0];
        c -= prev[0] + prev[1];
        a -= prev[1];
        int[] cnt = getInCount(repeat, w, x);
        int q = delta / cnt[0], r = delta % cnt[0];
        if (r > 0) {
            ans += (long) (cnt[0] + cnt[1]) * q;
            c -= (long) (cnt[0] + cnt[1]) * q;
            a -= (long) cnt[1] * q;
        } else {
            ans += (long) (cnt[0] + cnt[1]) * (q - 1);
            c -= (long) (cnt[0] + cnt[1]) * (q - 1);
            a -= (long) cnt[1] * (q - 1);
        }
        b = repeat;
        while (c > a) {
            ans++;
            c--;
            if (b >= x) {
                b -= x;
            } else {
                a--;
                b += w - x;
            }
        }
        out.println(ans);
    }

    int getRepeatElement(int b, int w, int x) {
        boolean[] vis = new boolean[N];
        while (!vis[b]) {
            vis[b] = true;
            if (b >= x) b -= x;
            else b += w - x;
        }
        return b;
    }

    int[] getPreCount(int b, int w, int x, int repeat) {
        int[] cnt = new int[2];
        while (b != repeat) {
            if (b >= x) {
                cnt[0]++;
                b -= x;
            } else {
                cnt[1]++;
                b += w - x;
            }
        }
        return cnt;
    }

    int[] getInCount(int b, int w, int x) {
        int tmp = -1;
        int[] cnt = new int[2];
        while (tmp != b) {
            if (tmp < 0) tmp = b;
            if (b >= x) {
                cnt[0]++;
                b -= x;
            } else {
                cnt[1]++;
                b += w - x;
            }
        }
        return cnt;
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NumberBusters().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class NumberBusters2 {
    void solve() {
        long a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();

        if (c <= a) {
            out.println(0);
            return;
        }

        long k = ((c - a) * x - b + w - x - 1) / (w - x);
        out.println(c - a + k);
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NumberBusters2().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		long a = ni();
		int b = ni();
		int w = ni();
		int x = ni();
		long c = ni();
		int step = 30000;

		int[] move_b = new int[w];
		for (int i = 0; i < w; i++)
			move_b[i] = i;
		int[] next_move = new int[w];

		int[] dif_b = new int[w];
		int[] next_dif = new int[w];

		for (int move = 1; move <= step; move++) {
			for (int bb = 0; bb < w; bb++) {
				int prev_b = move_b[bb];
				int prev_dif = dif_b[bb];

				if (prev_b >= x) {
					next_move[bb] = prev_b - x;
					next_dif[bb] = prev_dif;
				} else {
					next_move[bb] = w - (x - prev_b);
					next_dif[bb] = prev_dif + 1;
				}

			}
			int[] t = dif_b;
			dif_b = next_dif;
			next_dif = t;
			Arrays.fill(next_dif, 0);

			int[] t2 = move_b;
			move_b = next_move;
			next_move = t2;
			Arrays.fill(next_move, 0);

		}
		long t = 0;
		while (true) {
			long next_c = c -(long)step;
			long next_a = a - dif_b[b];
			if(next_c <= next_a)
				break;

			a -= dif_b[b];
			b = move_b[b];
			t += (long)step;
			c -= (long)step;

		}
		while (c > a) {
			c--;
			if (b < x)
				a--;
			if (b >= x) {
				b = b - x;
			} else {
				b = w - (x - b);
			}
			t++;
		}

		return t;
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
}

import java.io.*;
import java.util.*;

public class B {

    public void solve() {
        long a = in.nextLong();
        int b = in.nextInt(), w = in.nextInt(), x = in.nextInt();
        long c = in.nextLong();

        long left = -1, right = (long) 1e15;
        int curB = b;
        boolean[] used = new boolean[10000];
        int[] vals = new int[10000];
        int counter = 0;
        int curAs = 0;
        while (!used[curB]) {
            used[curB] = true;
            if (curB < x) {
                curB += w;
                curAs++;
            }
            curB -= x;
            counter++;
            vals[counter] = curAs;
        }

        while (left < right - 1) {
            long mid = (left + right) >> 1;

            long rmn = mid / counter;
            int mod = (int) (mid % counter);
            long subAs = rmn * vals[counter] + vals[mod];

            if (c - mid <= a - subAs) {
                right = mid;
            } else {
                left = mid;
            }
        }
        out.println(right);
    }

    FastScanner in;
    PrintWriter out;

    public void run() {
        try {
            in = new FastScanner();
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(String name) {
            try {
                br = new BufferedReader(new FileReader(name));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

    public static void main(String[] args) {
        new B().run();
    }
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.MAX_VALUE;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;

public class Main {
    public static void main(String[] args) throws IOException {
        Solver sv = new Solver();
        sv.solve();
    }
}

class Solver {
    BufferedReader in;
    StringTokenizer tok;
    final int S = 5000;
    int[] dp = new int[S * 2];
    int[] to = new int[S * 2];

    public void solve() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        //in = new BufferedReader(new FileReader("people.in"));
        //PrintWriter out = new PrintWriter(new File("people.out"));

        long a = nextLong();
        long b = nextLong();
        long w = nextLong();
        long x = nextLong();
        long c = nextLong();

        int plus = (int)(w - x);
        int minus = (int)x;

        for (int i = 0; i < 2 * S; ++i) {
            int t = i - S;
            if (t >= 0) {
                to[i] = S + t - minus;
            } else {
                to[i] = S + t + plus;
            }
        }

        boolean[] used = new boolean[2 * S];
        int t = (int)(b - x) + S;
        int[] dp = new int [2 * S];
        int cur = 0;
        do {
            used[t] = true;
            if (cur == 0) {
                dp[cur] = 0;
            } else {
                dp[cur] = dp[cur - 1];
            }
            if (t >= S) {
                dp[cur]++;
            }
            t = to[t];
            ++cur;
        } while(!used[t]);
        long diff = c - a;
        if (diff <= 0) {
            out.print(0);
            out.close();
        }
        long ans = 0;
        int cyc = dp[cur - 1];
        if (diff > cyc) {
            long cnt = (diff - 1) / cyc;
            ans += cnt * cur;
            diff -= cnt * cyc;
        }
        int i = 0;
        while(i < cur && dp[i] < diff) {
            ++i;
        }
        ans += i + 1;
        out.println(ans);
        out.close();
    }

    String next() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(next());
    }

    int nextInt() throws IOException {
        return parseInt(next());
    }

    long nextLong() throws IOException {
        return parseLong(next());
    }

    double nextDouble() throws IOException {
        return parseDouble(next());
    }
}

import java.util.*;
import java.io.*;

public class Busters {
    public static void main(String[] args) throws IOException {
        BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(rd.readLine());
        a = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        w = Integer.parseInt(st.nextToken());
        x = Integer.parseInt(st.nextToken());
        c = Integer.parseInt(st.nextToken());
        countPeriods();
        System.out.println(bin(0, Long.MAX_VALUE/1000));
    }

    static long bin(long a, long b){
        if(a==b) return a;
        if(b==a+1) return check(a) ? a : b;
        long m = (a+b)/2;
        return check(m) ? bin(a, m) : bin(m+1, b);
    }

    static boolean check(long X){
        long A = a - count(X), C = c-X;
        return C <= A;
    }

    static long count(long X){
        if(X<=P) return simulation((int)X);
        long res = 1L*S*(X/P);
        return res + count(X % P);
    }

    static int simulation(int X){
        int num = 0;
        int B = b;
        for(int i=0; i<X; i++){
            if(B>=x){
                B -= x;
            }
            else{
                B -= x;
                B += w;
                num++;
            }
        }
        return num;
    }

    static void countPeriods(){
        int curB = b;
        boolean first = true;
        while(true){
            if(curB==b && !first) break;
            first = false;
            if(curB >= x){
                curB -= x;
                P++;
            }
            else{
                P++;
                S++;
                curB -= x;
                curB += w;
            }
        }
    }

    static int P, S;

    static int a, b, w, x, c;

}

import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        long c = in.nextLong();
        long lo = 0;
        long hi = (long) 1e18;
        long ans = -1;
        while (lo <= hi) {
            long mid = lo + (hi - lo) / 2;
            long temp = mid;
            int B = b;
            long A = a;
            long[] seen = new long[2 * w];
            long[] aVal = new long[2 * w];
            Arrays.fill(seen, -1);
            while (temp > 0) {
                if (seen[B] != -1) {
                    long tDiff = seen[B] - temp;
                    long rounds = temp / tDiff;
                    long aDiff = aVal[B] - A;
                    A -= rounds * aDiff;
                    temp -= rounds * tDiff;
                    Arrays.fill(seen, -1);
                } else {
                    seen[B] = temp;
                    aVal[B] = A;
                    temp--;
                    if (B < x) {
                        B += w - x;
                        A--;
                    } else
                        B -= x;
                }
            }
            if (c - mid <= A) {
                ans = mid;
                hi = mid - 1;
            } else
                lo = mid + 1;
        }
        System.out.println(ans);
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author fattychicken
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long low = 0, high = 100000000000000L;
        while (low < high) {
            long mid = (low + high) >> 1L;
            long nowC = c - mid;
            long delta = mid * x;
            long nowA = a - delta / w;
            delta %= w;
            if (delta > b) {
                --nowA;
            }
            if (nowC <= nowA) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        out.println(low);
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

public class Main {

    InputReader input;
    PrintWriter output;

    void run(){
        output = new PrintWriter(new OutputStreamWriter(System.out));
        input = new InputReader(System.in);
        solve();
        output.flush();
    }

    public static void main(String[] args){
        new Main().run();
    }

    long a, b, w, x;
    long c;

    void solve() {
        a = input.ni();
        b = input.ni();
        w = input.ni();
        x = input.ni();
        c = input.ni();
        if(c <= a) {
            output.println("0");
            return;
        }
        findMin();
    }

    void findMin() {
        long lo = 1;
        long hi = Long.MAX_VALUE / 2;
        while(lo < hi) {
            long mid = (lo + hi)>>1;
            if(possible(mid)) {
                hi = mid;
            }
            else {
                lo = mid+1;
            }
        }
        output.println(hi);
    }

    boolean possible(long time) {
        long currA = a;
        long currC = c;
        long q = Math.max(x*time - b, 0);
        long numSecondOperation = (q+w-1) / w;
        currA -= numSecondOperation;
        currC -= time;
        return currA >= currC;
    }

    class InputReader {
        private boolean finished = false;
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
                this.stream = stream;
        }

        public int read() {
                if (numChars == -1)
                        throw new InputMismatchException();
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int peek() {
                if (numChars == -1)
                        return -1;
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                return -1;
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar];
        }

        public int ni() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                int res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public long nl() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                long res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public String ns() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                StringBuilder res = new StringBuilder();
                do {
                        res.appendCodePoint(c);
                        c = read();
                } while (!isSpaceChar(c));
                return res.toString();
        }

        public boolean isSpaceChar(int c) {
                if (filter != null)
                        return filter.isSpaceChar(c);
                return isWhitespace(c);
        }

        public boolean isWhitespace(int c) {
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
                StringBuilder buf = new StringBuilder();
                int c = read();
                while (c != '\n' && c != -1) {
                        if (c != '\r')
                                buf.appendCodePoint(c);
                        c = read();
                }
                return buf.toString();
        }

        public String readLine() {
                String s = readLine0();
                while (s.trim().length() == 0)
                        s = readLine0();
                return s;
        }

        public String readLine(boolean ignoreEmptyLines) {
                if (ignoreEmptyLines)
                        return readLine();
                else
                        return readLine0();
        }

        public BigInteger readBigInteger() {
                try {
                        return new BigInteger(ns());
                } catch (NumberFormatException e) {
                        throw new InputMismatchException();
                }
        }

        public char readCharacter() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                return (char) c;
        }

        public double readDouble() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                double res = 0;
                while (!isSpaceChar(c) && c != '.') {
                        if (c == 'e' || c == 'E')
                                return res * Math.pow(10, ni());
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                }
                if (c == '.') {
                        c = read();
                        double m = 1;
                        while (!isSpaceChar(c)) {
                                if (c == 'e' || c == 'E')
                                        return res * Math.pow(10, ni());
                                if (c < '0' || c > '9')
                                        throw new InputMismatchException();
                                m /= 10;
                                res += (c - '0') * m;
                                c = read();
                        }
                }
                return res * sgn;
        }

        public boolean eof() {
                int value;
                while (isSpaceChar(value = peek()) && value != -1)
                        read();
                return value == -1;
        }

        public String next() {
                return ns();
        }

        public SpaceCharFilter getFilter() {
                return filter;
        }

        public void setFilter(SpaceCharFilter filter) {
                this.filter = filter;
        }

    }
     public interface SpaceCharFilter {
         public boolean isSpaceChar(int ch);
     }

}

import java.util.*;
import java.io.*;

public class Main {
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
long a = sc.nextInt();
long b = sc.nextInt();
long w = sc.nextInt();
long x = sc.nextInt();
long c = sc.nextInt();

long nr1 = a*w+b;
long d1 = x;
long nr2 = c*w;
long d2 = w;

long time = 0;

while (nr1<nr2){
  long step = (nr2-nr1)/w;
  if (step==0) step++;
  time+=step;
  nr1-=step*d1;
  nr2-=step*d2;
}

System.out.println(time);
}
}

import java.io.*;
import java.util.*;

public class codef382b {
	public static void main(String args[]) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String[] arrs = in.readLine().split("\\s");

		int a = Integer.parseInt(arrs[0]);
		int b = Integer.parseInt(arrs[1]);
		int w = Integer.parseInt(arrs[2]);
		int x = Integer.parseInt(arrs[3]);
		int c = Integer.parseInt(arrs[4]);

		long n = 0;
		int diff = c - a;

		while(diff > 0) {
			int i = diff / (w - x);
			diff = (diff % (w - x)) + (w - x);

			n = ((long) (i-1) * (long) w);

			while(diff > 0) {
				if(b < x) {
					b += (w - x);
				}
				else {
					diff--;
					b-= x;
				}
				n++;
			}
		}

		System.out.println(n);
	}
}

//package round224;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class B {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int a = ni(), b = ni(), w = ni(), x = ni(), c = ni();
		long time = (long)c-a;
		if(time <= 0){
			out.println(0);
			return;
		}
		int[] d = new int[3000];
		Arrays.fill(d, 999999);
		int tail = -1, period = -1;
		int st = 0;
		int ob = b;
		while(true){
			d[b] = st++;
			if(b >= x){
				b -= x;
			}else{
				b = w-(x-b);
			}
			if(d[b] < 99999){
				tail = d[b];
				period = st-d[b];
				break;
			}
		}
		b = ob;
		for(int i = 1;i <= tail;i++){
			time--;
			if(b >= x){
				b -= x;
			}else{
				b = w-(x-b);
				time++;
			}
			if(time <= 0){
				out.println(i);
				return;
			}
		}

		int inc = 0;
		for(int i = 0;i < period;i++){
			if(b >= x){
				b -= x;
			}else{
				b = w-(x-b);
				inc++;
			}
		}

		long cycle = time / (period-inc);
		if(cycle > 0)cycle--;
		long step = (long)tail + cycle * period;
		time -= cycle * (period-inc);

		if(time <= 0){
			out.println(step);
			return;
		}
		for(int i = 0;;i++){
			time--;
			if(b >= x){
				b -= x;
			}else{
				b = w-(x-b);
				time++;
			}
			step++;
			if(time <= 0){
				out.println(step);
				return;
			}
		}
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new B().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.io.IOException;
import java.util.Arrays;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin <aladdin3>
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader jin, PrintWriter jout) {
        int a = jin.integer();
        int b = jin.integer();
        int w = jin.integer();
        int x = jin.integer();
        int c = jin.integer();

        int[] times = new int[w + 1];
        times[0] = 0;
        for(int i = 1; i <= w; i++) {
            times[i] = times[i - 1];
            if(i % x == 0) times[i]++;
            //jout.println(i + "->" + times[i]);
        }
        long[] start = new long[w + 1];
        long[] value = new long[w + 1];
        Arrays.fill(start, -1);
        long count = 0;
        long diff = c - a;
        while(diff > 0) {
            if(start[b] != -1) {
                //jout.print(b + " " + count + " " + start[b] + " " + diff);
                long time = count - start[b];
                long tdiff = value[b] - diff;
                //jout.print(" " + time + " " + tdiff);
                int cost = (diff % tdiff == 0 && diff > 0)? 1: 0;
                count += ((diff / tdiff) - cost) * time;
                diff = (diff % tdiff) + cost * tdiff;
                //jout.println(" " + count + " " + diff);
                if(diff == 0) count--;
                Arrays.fill(start, -1);
            }
            start[b] = count;
            value[b] = diff;
            if(diff <= times[b]) {
                count += diff;
                diff = 0;
            } else {
                count += times[b] + 1;
                diff -= times[b];
                b = b + (w - ((times[b] + 1) * x));
            }
        }
        jout.println(count);

    }
}

class InputReader {
    private static final int bufferMaxLength = 1024;
    private InputStream in;
    private byte[] buffer;
    private int currentBufferSize;
    private int currentBufferTop;
    private static final String tokenizers = " \t\r\f\n";

    public InputReader(InputStream stream) {
        this.in = stream;
        buffer = new byte[bufferMaxLength];
        currentBufferSize = 0;
        currentBufferTop = 0;
    }

    private boolean refill() {
        try {
            this.currentBufferSize = this.in.read(this.buffer);
            this.currentBufferTop = 0;
        } catch(Exception e) {}
        return this.currentBufferSize > 0;
    }

    private Byte readChar() {
        if(currentBufferTop < currentBufferSize) {
            return this.buffer[this.currentBufferTop++];
        } else {
            if(!this.refill()) {
                return null;
            } else {
                return readChar();
            }
        }
    }

    public String token()  {
        StringBuffer tok = new StringBuffer();
        Byte first;
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));
        if(first == null) return null;
        tok.append((char)first.byteValue());
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {
            tok.append((char)first.byteValue());
        }
        return tok.toString();
    }

    public Integer integer() throws NumberFormatException {
        String tok = token();
        return tok == null? null : Integer.parseInt(tok);
    }

    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strings = reader.readLine().split(" ");
		long a = Integer.valueOf(strings[0]);
		long b = Integer.valueOf(strings[1]);
		long w = Integer.valueOf(strings[2]);
		long x = Integer.valueOf(strings[3]);
		long c = Integer.valueOf(strings[4]);
		long n = ((c - a) * w - b + w - x - 1) / (w - x);
		System.out.println(n < 0 ? 0 : n);

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		String[] strings = reader.readLine().split(" ");
		long a = Integer.valueOf(strings[0]);
		long b = Integer.valueOf(strings[1]);
		long w = Integer.valueOf(strings[2]);
		long x = Integer.valueOf(strings[3]);
		long c = Integer.valueOf(strings[4]);
		long n = ((c - a) * w - b + w - x - 1) / (w - x);
		System.out.println(Math.max(0, n));

	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class NumberBusters {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int A = sc.nextInt();
        int B = sc.nextInt();
        int W = sc.nextInt();
        int X = sc.nextInt();
        int C = sc.nextInt();

        long left = 0;
        long rite = 2000000000000L;
        long good = -1;
        while (left <= rite) {
        	long mid = (left + rite) / 2;
        	long currC = C - mid;
        	long currA = A - (W - B - 1 + mid * X) / W;
        	if (currC <= currA) {
        		good = mid;
        		rite = mid - 1;
        	} else {
        		left = mid + 1;
        	}
        }
        System.out.println(good);
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try { str = br.readLine(); }
            catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }
}

import java.util.Scanner;

public class Practica_4 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();
        long w = in.nextLong();
        long x = in.nextLong();
        long c = in.nextLong();
        long contador = 0;
        long low = 0, high = 100000000000000L;
        while (low < high) {
            long mid = (low + high) >> 1L;
            long nowC = c - mid;
            long delta = mid * x;
            long nowA = a - delta / w;
            delta %= w;
            if (delta > b) {
                --nowA;
            }
            if (nowC <= nowA) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        System.out.println(low);
    }
}

import java.util.Scanner;

public class Number_Busters {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();
        long w = in.nextLong();
        long x = in.nextLong();
        long c = in.nextLong();
        long contador = 0;
        long low = 0, high = 100000000000000L;
        while (low < high) {
            long mid = (low + high) >> 1L;
            long nowC = c - mid;
            long delta = mid * x;
            long nowA = a - delta / w;
            delta %= w;
            if (delta > b) {
                --nowA;
            }
            if (nowC <= nowA) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        System.out.println(low);
    }
}

import java.io.*;
import java.util.*;

public class p382b
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.println();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long w = sc.nextLong();
        long x = sc.nextLong();
        long c = sc.nextLong();
        if(c<=a) System.out.println("0");
        else System.out.printf("%.0f\n",Math.ceil(((double)(a-c)*w+b)/(x-w)));
    }
}

import java.io.*;
import java.util.*;

public class B {
    public static void main(String[] args) throws Exception {
        new B().solve();
        // new FileInputStream(new File("input.txt")),
        // new PrintStream(new FileOutputStream(new File("output.txt"))));
    }
    void solve() throws IOException {
        BufferedReader in = new BufferedReader(new
                InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        String[] sp;

        sp = in.readLine().split(" ");
        long a = Integer.parseInt(sp[0]);
        int b = Integer.parseInt(sp[1]);
        int w = Integer.parseInt(sp[2]);
        int x = Integer.parseInt(sp[3]);
        long c = Integer.parseInt(sp[4]);

        System.out.println(s1(a, b, w, x, c));

    }

    long s2(long a, int b, int w, int x, long c) {

        for (int t = 0;; t++) {
            if (c <= a) {
                return t;
            } else {
                c--;
                if (b >= x) {
                    b -= x;
                } else {
                    a--;
                    b = w - (x - b);
                }
            }
        }

    }

    long s1(long a, int b, int w, int x, long c) {
        // loop
        int T = 0;
        long[] am = new long[10000];
        int[] bb = new int[10000];
        bb[0] = b;
        do {
            if (bb[T] >= x) {
                am[T + 1] = am[T];
                bb[T + 1] = bb[T] - x;
            } else {
                am[T + 1] = am[T] + 1;
                bb[T + 1] = w - (x - bb[T]);
            }
            T++;
        } while (bb[T] != b);

        long up = Long.MAX_VALUE / 4;
        long btm = -1;
        while (up - btm > 1) {
            long m = (up + btm) / 2;

            long aa = a - (m / T * am[T] + am[(int) (m % T)]);
            long cc = c - m;

            if (cc <= aa) {
                up = m;
            } else {
                btm = m;
            }
        }
        return up;
    }
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
        long a, c;
        int b, w, x;

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                a = in.nextLong();
                b = in.nextInt();
                w = in.nextInt();
                x = in.nextInt();
                c = in.nextLong();
                long[] delta = new long[w];
                Arrays.fill(delta, -1);
                int cur = b;
                while (true) {
                        if (delta[cur] != -1)
                                break;
                        delta[cur] = cur / x;
                        cur = get(cur);
                }
                boolean[] was = new boolean[w];
                int v = 0;
                cur = b;
                long all = 0;
                while (true) {
                        if (was[cur])  {
                                v = cur;
                                break;
                        }
                        all += delta[cur];
                        was[cur] = true;
                        cur = get(cur);
                }
                long cyc = 0;
                int len = 0;
                Arrays.fill(was, false);
                cur = v;
                while (true) {
                        if (was[cur])  {
                                break;
                        }
                        cyc += delta[cur];
                        len++;
                        was[cur] = true;
                        cur = get(cur);
                }
                all -= cyc;
                long toGo = c - a;
                long res = 0;
                if (all >= toGo) {
                        cur = b;
                        while (toGo > 0) {
                                if (toGo > delta[cur]) {
                                        toGo -= delta[cur];
                                        res += delta[cur] + 1;
                                } else {
                                        res += toGo;
                                        toGo = 0;
                                }
                                cur = get(cur);
                        }
                        out.println(res + toGo);
                        return;
                }
                cur = b;
                while (cur != v) {
                        toGo -= delta[cur];
                        res += delta[cur] + 1;
                        cur = get(cur);
                }
                long steps = Math.max(0L, toGo / cyc - 1);
                res += (cyc + len) * steps;
                toGo -= cyc * steps;
                while (toGo > 0) {
                        if (toGo > delta[cur]) {
                                toGo -= delta[cur];
                                res += delta[cur] + 1;
                        } else {
                                res += toGo;
                                toGo = 0;
                        }
                        cur = get(cur);
                }
                res += toGo;
                out.println(res + toGo);
        }

        int get(int y) {
                y %= x;
                y = w - (x - y);
                return y;
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

        public long nextLong() {
                return Long.parseLong(nextToken());
        }

        }

import java.util.*;
import java.io.*;

public class Main implements Runnable {

    public void solve() throws IOException {
        int a = nextInt();
        int b = nextInt();
        int w = nextInt();
        int x = nextInt();
        int c = nextInt();
        //1 0 2 1 2000000000 ans: 3999999998
        //System.out.println(a+" "+b+" "+w+" "+x+" "+c);
        //1 0 1000 999 2000000000
        //ans: 1999999999000
        int iters = 0;
        int q = b;
        int del = 0;
        while (true) {
            iters++;
            if (q < x) {
                del++;
                q = w - (x - q);
            } else {
                q -= x;
            }
            if (q == b) {
                break;
            }
        }
        //System.err.println(q + " " + b + " " + iters + " " + del);
        long l = 0;
        long r = Long.MAX_VALUE;
        while (l < r) {
            long mid = l + r;
            mid /= 2;
            long t1 = c - mid;
            long fc = mid / iters;
            long rem = mid % iters;
            long t2 = a - del * fc;
            q = b;
            for (int i = 0; i < rem; i++) {
                if (q < x) {
                    t2--;
                    q = w - (x - q);
                } else {
                    q -= x;
                }
            }
            if (t2 >= t1) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        System.out.println(l);
    }

    String[] check(String in) {
        String[] ret = new String[2];
        Arrays.fill(ret, "");
        int i = 0;
        for (i = 0; i < in.length(); i++) {
            if (in.charAt(i) == '|') {
                break;
            }
            ret[0] += in.charAt(i);
        }
        i++;
        for (; i < in.length(); i++) {
            //if(in.charAt(i)=='|')break;
            ret[1] += in.charAt(i);
        }
        return ret;
    }

    int answer(int[] a, int[] b) {
        int n = a.length;
        b = b.clone();
        a = a.clone();
        for (int i = 0; i < n; i++) {
            if (b[i] >= 0) {
                merge(a, i, b[i]);
            }
        }
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] < 0) {
                cnt++;
            }
        }
        return cnt;
    }

    void merge(int[] arr, int a, int b) {
        a = get(arr, a);
        b = get(arr, b);
        if (a != b) {
            if (arr[a] > arr[b]) {
                int t = a;
                a = b;
                b = t;
            }
            arr[a] += arr[b];
            arr[b] = a;
        }
    }

    int get(int[] arr, int a) {
        if (arr[a] < 0) {
            return a;
        }
        return arr[a] = get(arr, arr[a]);
    }

    void shuffle(int[] a) {
        int N = a.length;
        for (int i = 0; i < N / 2; i++) {
            int j = (int) (Math.random() * N);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

    void print(Object... obj) {
        for (Object o : obj) {
            System.out.println(o);
        }
    }

    void print(int[] a) {
        System.out.println();
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + " ");
        }
    }

    void print(int[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    void print(boolean[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    boolean nextPermutation(int[] arr) {
        int f = -1;
        for (int i = arr.length - 2; i >= 0; i--) {
            if (arr[i + 1] > arr[i]) {
                f = i;
                break;
            }
        }
        if (f == -1) {
            return false;
        }
        int s = -1;
        for (int i = arr.length - 1; i >= 0; i--) {
            if (arr[i] > arr[f]) {
                s = i;
                break;
            }
        }
        int d = arr[f];
        arr[f] = arr[s];
        arr[s] = d;

        f++;
        int l = arr.length - 1;
        while (f < l) {
            d = arr[f];
            arr[f] = arr[l];
            arr[l] = d;
            f++;
            l--;
        }
        return true;
    }

    //-----------------------------------------------------------
    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            solve();
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    public String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    BufferedReader in;
    StringTokenizer tok;
}

class Student {

    int idx;
    int level;
    int cost;

    public Student(int i, int l) {
        idx = i;
        level = l;
    }

    public String toString() {
        return idx + " " + level + " " + cost;
    }
    public static final Comparator<Student> byLevel = new Comparator<Student>() {
        public int compare(Student a, Student b) {
            if (a.level != b.level) {
                return b.level - a.level;
            }
            if (a.cost != b.cost) {
                return a.cost - b.cost;
            }
            return a.idx - b.idx;
        }
    };
    public static final Comparator<Student> byCost = new Comparator<Student>() {
        public int compare(Student a, Student b) {
            if (a.cost != b.cost) {
                return a.cost - b.cost;
            }
            if (a.level != b.level) {
                return b.level - a.level;
            }
            return a.idx - b.idx;
        }
    };
}

class Bug implements Comparable<Bug> {

    int idx;
    int level;

    public Bug(int idx, int level) {
        this.idx = idx;
        this.level = level;
    }

    public int compareTo(Bug other) {
        if (level != other.level) {
            return other.level - level;
        }
        return idx - other.idx;
    }

    public String toString() {
        return idx + " " + level;
    }
}

import java.util.*;
import java.io.*;

public class Main implements Runnable {

    public void solve() throws IOException {
        int a = nextInt();
        int b = nextInt();
        int w = nextInt();
        int x = nextInt();
        int c = nextInt();
        //1 0 2 1 2000000000 ans: 3999999998
        //System.out.println(a+" "+b+" "+w+" "+x+" "+c);
        //1 0 1000 999 2000000000
        //ans: 1999999999000
        int iters = 0;
        int q = b;
        int del = 0;
        while (true) {
            iters++;
            if (q < x) {
                del++;
                q = w - (x - q);
            } else {
                q -= x;
            }
            if (q == b) {
                break;
            }
        }
        //System.err.println(q + " " + b + " " + iters + " " + del);
        long l = 0;
        long r = Long.MAX_VALUE;
        while (l < r) {
            long mid = l + r;
            mid /= 2;
            long t1 = c - mid;
            long fc = mid / iters;
            long rem = mid % iters;
            long t2 = a - del * fc;
            q = b;
            if (t2 - rem >= t1) {
                r = mid;
                continue;
            }
            for (int i = 0; i < rem; i++) {
                if (q < x) {
                    t2--;
                    q = w - (x - q);
                } else {
                    q -= x;
                }
            }
            if (t2 >= t1) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        System.out.println(l);
    }

    String[] check(String in) {
        String[] ret = new String[2];
        Arrays.fill(ret, "");
        int i = 0;
        for (i = 0; i < in.length(); i++) {
            if (in.charAt(i) == '|') {
                break;
            }
            ret[0] += in.charAt(i);
        }
        i++;
        for (; i < in.length(); i++) {
            //if(in.charAt(i)=='|')break;
            ret[1] += in.charAt(i);
        }
        return ret;
    }

    int answer(int[] a, int[] b) {
        int n = a.length;
        b = b.clone();
        a = a.clone();
        for (int i = 0; i < n; i++) {
            if (b[i] >= 0) {
                merge(a, i, b[i]);
            }
        }
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] < 0) {
                cnt++;
            }
        }
        return cnt;
    }

    void merge(int[] arr, int a, int b) {
        a = get(arr, a);
        b = get(arr, b);
        if (a != b) {
            if (arr[a] > arr[b]) {
                int t = a;
                a = b;
                b = t;
            }
            arr[a] += arr[b];
            arr[b] = a;
        }
    }

    int get(int[] arr, int a) {
        if (arr[a] < 0) {
            return a;
        }
        return arr[a] = get(arr, arr[a]);
    }

    void shuffle(int[] a) {
        int N = a.length;
        for (int i = 0; i < N / 2; i++) {
            int j = (int) (Math.random() * N);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

    void print(Object... obj) {
        for (Object o : obj) {
            System.out.println(o);
        }
    }

    void print(int[] a) {
        System.out.println();
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + " ");
        }
    }

    void print(int[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    void print(boolean[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    boolean nextPermutation(int[] arr) {
        int f = -1;
        for (int i = arr.length - 2; i >= 0; i--) {
            if (arr[i + 1] > arr[i]) {
                f = i;
                break;
            }
        }
        if (f == -1) {
            return false;
        }
        int s = -1;
        for (int i = arr.length - 1; i >= 0; i--) {
            if (arr[i] > arr[f]) {
                s = i;
                break;
            }
        }
        int d = arr[f];
        arr[f] = arr[s];
        arr[s] = d;

        f++;
        int l = arr.length - 1;
        while (f < l) {
            d = arr[f];
            arr[f] = arr[l];
            arr[l] = d;
            f++;
            l--;
        }
        return true;
    }

    //-----------------------------------------------------------
    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            solve();
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    public String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    BufferedReader in;
    StringTokenizer tok;
}

class Student {

    int idx;
    int level;
    int cost;

    public Student(int i, int l) {
        idx = i;
        level = l;
    }

    public String toString() {
        return idx + " " + level + " " + cost;
    }
    public static final Comparator<Student> byLevel = new Comparator<Student>() {
        public int compare(Student a, Student b) {
            if (a.level != b.level) {
                return b.level - a.level;
            }
            if (a.cost != b.cost) {
                return a.cost - b.cost;
            }
            return a.idx - b.idx;
        }
    };
    public static final Comparator<Student> byCost = new Comparator<Student>() {
        public int compare(Student a, Student b) {
            if (a.cost != b.cost) {
                return a.cost - b.cost;
            }
            if (a.level != b.level) {
                return b.level - a.level;
            }
            return a.idx - b.idx;
        }
    };
}

class Bug implements Comparable<Bug> {

    int idx;
    int level;

    public Bug(int idx, int level) {
        this.idx = idx;
        this.level = level;
    }

    public int compareTo(Bug other) {
        if (level != other.level) {
            return other.level - level;
        }
        return idx - other.idx;
    }

    public String toString() {
        return idx + " " + level;
    }
}

import java.util.*;
import java.io.*;

public class Main implements Runnable {

    public void solve() throws IOException {
        long a = nextInt();
        long b = nextInt();
        long w = nextInt();
        long x = nextInt();
        long c = nextInt();
        /*
         //1 0 2 1 2000000000 ans: 3999999998
         //System.out.println(a+" "+b+" "+w+" "+x+" "+c);
         //1 0 1000 999 2000000000
         //ans: 1999999999000
         int iters = 0;
         int q = b;
         int del = 0;
         while (true) {
         iters++;
         if (q < x) {
         del++;
         q = w - (x - q);
         } else {
         q -= x;
         }
         if (q == b) {
         break;
         }
         }
         //System.err.println(q + " " + b + " " + iters + " " + del);
         long l = 0;
         long r = Long.MAX_VALUE;
         while (l < r) {
         long mid = l + r;
         mid /= 2;
         long t1 = c - mid;
         long fc = mid / iters;
         long rem = mid % iters;
         long t2 = a - del * fc;
         q = b;
         if (t2 - rem >= t1) {
         r = mid;
         continue;
         }
         for (int i = 0; i < rem; i++) {
         if (q < x) {
         t2--;
         q = w - (x - q);
         } else {
         q -= x;
         }
         }
         if (t2 >= t1) {
         r = mid;
         } else {
         l = mid + 1;
         }
         }
         System.out.println(l);*/
        long diff = c - a;
        if (diff <= 0) {
            System.out.println(0);
            return;
        } else {
            double k = ((b - (c - a) * x) * 1.0) / ((x - w) * 1.0);
            long ans = (long) Math.ceil(c - a + k);
            System.out.println(ans);
        }
    }

    String[] check(String in) {
        String[] ret = new String[2];
        Arrays.fill(ret, "");
        int i = 0;
        for (i = 0; i < in.length(); i++) {
            if (in.charAt(i) == '|') {
                break;
            }
            ret[0] += in.charAt(i);
        }
        i++;
        for (; i < in.length(); i++) {
            //if(in.charAt(i)=='|')break;
            ret[1] += in.charAt(i);
        }
        return ret;
    }

    int answer(int[] a, int[] b) {
        int n = a.length;
        b = b.clone();
        a = a.clone();
        for (int i = 0; i < n; i++) {
            if (b[i] >= 0) {
                merge(a, i, b[i]);
            }
        }
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] < 0) {
                cnt++;
            }
        }
        return cnt;
    }

    void merge(int[] arr, int a, int b) {
        a = get(arr, a);
        b = get(arr, b);
        if (a != b) {
            if (arr[a] > arr[b]) {
                int t = a;
                a = b;
                b = t;
            }
            arr[a] += arr[b];
            arr[b] = a;
        }
    }

    int get(int[] arr, int a) {
        if (arr[a] < 0) {
            return a;
        }
        return arr[a] = get(arr, arr[a]);
    }

    void shuffle(int[] a) {
        int N = a.length;
        for (int i = 0; i < N / 2; i++) {
            int j = (int) (Math.random() * N);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

    void print(Object... obj) {
        for (Object o : obj) {
            System.out.println(o);
        }
    }

    void print(int[] a) {
        System.out.println();
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + " ");
        }
    }

    void print(int[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    void print(boolean[][] arr) {
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }

    boolean nextPermutation(int[] arr) {
        int f = -1;
        for (int i = arr.length - 2; i >= 0; i--) {
            if (arr[i + 1] > arr[i]) {
                f = i;
                break;
            }
        }
        if (f == -1) {
            return false;
        }
        int s = -1;
        for (int i = arr.length - 1; i >= 0; i--) {
            if (arr[i] > arr[f]) {
                s = i;
                break;
            }
        }
        int d = arr[f];
        arr[f] = arr[s];
        arr[s] = d;

        f++;
        int l = arr.length - 1;
        while (f < l) {
            d = arr[f];
            arr[f] = arr[l];
            arr[l] = d;
            f++;
            l--;
        }
        return true;
    }

    //-----------------------------------------------------------
    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            solve();
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    public String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    BufferedReader in;
    StringTokenizer tok;
}

class Student {

    int idx;
    int level;
    int cost;

    public Student(int i, int l) {
        idx = i;
        level = l;
    }

    public String toString() {
        return idx + " " + level + " " + cost;
    }
    public static final Comparator<Student> byLevel = new Comparator<Student>() {
        public int compare(Student a, Student b) {
            if (a.level != b.level) {
                return b.level - a.level;
            }
            if (a.cost != b.cost) {
                return a.cost - b.cost;
            }
            return a.idx - b.idx;
        }
    };
    public static final Comparator<Student> byCost = new Comparator<Student>() {
        public int compare(Student a, Student b) {
            if (a.cost != b.cost) {
                return a.cost - b.cost;
            }
            if (a.level != b.level) {
                return b.level - a.level;
            }
            return a.idx - b.idx;
        }
    };
}

class Bug implements Comparable<Bug> {

    int idx;
    int level;

    public Bug(int idx, int level) {
        this.idx = idx;
        this.level = level;
    }

    public int compareTo(Bug other) {
        if (level != other.level) {
            return other.level - level;
        }
        return idx - other.idx;
    }

    public String toString() {
        return idx + " " + level;
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author nasko
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long start = 0;
        long end = 1000000000000000000L;

        long best = end;
        while(start < end) {

            long mid = ( start + end )  >> 1L;

            long tempC = c - mid;
            long tempA = a - (  mid* x ) / w;

            long tempB = ( b + mid*x) % w;

            long delta = ( mid * x ) % w;
            if(delta > b) --tempA;

            if(tempC <= tempA) {
                best = Math.min(best,mid);
                end = mid;
            } else start = mid + 1;
        }
        out.println(start);

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class h {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long low = 0, high = 1000000000000000000L;
        while (low < high) {
            long mid = (low + high) >> 1L;
            long nowC = c - mid;
            long delta = mid * x;
            long nowA = a - delta / w;
            delta %= w;
            if (delta > b) {
                --nowA;
            }
            if (nowC <= nowA) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        out.println(low);
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

import java.util.Scanner;

public class B_224 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int w = in.nextInt();
		int x = in.nextInt();
		int c = in.nextInt();
		int start = 0;
//		while(b<x){
//			b = w - x + b;
//			a--;
//			c--;
//			start++;
//		}
//		int zero = w+b-x;
//		int modZero = w-(zero-x);
//		b = modZero;
//		System.out.println("b="+b);
		b = w-b-1;
		long lo = 0;
		long hi = 4*(long)10e13;
		while(lo < hi){
			long k = (lo+hi)/2;
			//System.out.println("k="+k);
			long bb = (b+k*x)%w;
			long aa = a - (b+k*x) / w;
			long cc = c - k;
			if(cc <= aa){
				hi = k;
			} else{
				lo = k+1;
			}
		}
		System.out.println((lo+start));
		//System.out.println(start);
	}

}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.net.ssl.SSLContext;

public class Main
{
	/********************************************** a list of common variables **********************************************/
	private MyScanner scan = new MyScanner();
	private PrintWriter out = new PrintWriter(System.out);
	private final double PI = Math.acos(-1.0);
	private final double EPS = 1e-6;
	private final int SIZEN = (int)(1e5);
	private final int MOD = (int)(1e9 + 7);
	private final long MODH = 10000000007L, BASE = 10007;
	private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};
	private ArrayList<Integer>[] edge;

	public void foo()
	{
		int a = scan.nextInt();
		int b = scan.nextInt();
		int w = scan.nextInt();
		int x = scan.nextInt();
		int c = scan.nextInt();
		if(b / x >= c - a)
		{
			out.println(Math.max(c - a, 0));
			return;
		}
		long ans = b / x;
		c -= b / x;
		b %= x;
		int[] index = new int[x];
		Arrays.fill(index, -1);
		index[b] = 0;
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		int p = 1;
		while(true)
		{
			int k1 = (w - b - 1) / (w - x);
			int k2 = (b + (w - x) * k1) / x;
			b = (b + (w - x) * k1) % x;
			arr1.add(k1);
			arr2.add(k2);
			if(index[b] != -1)
			{
				p = index[b];
				break;
			}
			index[b] = p++;
		}
		int d = c - a;
		for(int i = 0;i < p;++i)
		{
			if(d <= arr2.get(i))
			{
				ans += arr1.get(i) + d;
				d = 0;
				break;
			}
			else
			{
				ans += arr1.get(i) + arr2.get(i);
				d -= arr2.get(i);
			}
		}
		if(0 == d)
		{
			out.println(ans);
			return;
		}
		long sum1 = 0, sum2 = 0;
		for(int i = p;i < arr1.size();++i)
		{
			sum1 += arr1.get(i);
			sum2 += arr2.get(i);
		}
		sum1 += sum2;
		ans += d / sum2 * sum1;
		d %= sum2;
		if(d > 0)
		{
			for(int i = p;i < arr1.size();++i)
			{
				if(d <= arr2.get(i))
				{
					ans += arr1.get(i) + d;
					break;
				}
				else
				{
					ans += arr1.get(i) + arr2.get(i);
					d -= arr2.get(i);
				}
			}
		}
		out.println(ans);
  	}

	public static void main(String[] args)
	{
		Main m = new Main();
		m.foo();
		m.out.close();
	}

	class Point
	{
		private int x;
		private int y;
		public Point(int aX, int aY)
		{
			x = aX;
			y = aY;
		}
	}

	/********************************************** a list of common algorithms **********************************************/
	/**
	 * 1---Get greatest common divisor
	 * @param a :	first number
	 * @param b :	second number
	 * @return		greatest common divisor
	 */
	public long gcd(long a, long b)
	{
		return 0 == b ? a : gcd(b, a % b);
	}

	/**
	 * 2---Get the distance from a point to a line
	 * @param x1	the x coordinate of one endpoint of the line
	 * @param y1	the y coordinate of one endpoint of the line
	 * @param x2	the x coordinate of the other endpoint of the line
	 * @param y2	the y coordinate of the other endpoint of the line
	 * @param x		the x coordinate of the point
	 * @param y		the x coordinate of the point
	 * @return		the distance from a point to a line
	 */
	public double getDist(long x1, long y1, long x2, long y2, long x, long y)
	{
		long a = y2 - y1;
		long b = x1 - x2;
		long c = y1 * (x2 - x1) - x1 * (y2 - y1);
		return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
	}

	/**
	 * 3---Get the distance from one point to a segment (not a line)
	 * @param x1	the x coordinate of one endpoint of the segment
	 * @param y1	the y coordinate of one endpoint of the segment
	 * @param x2	the x coordinate of the other endpoint of the segment
	 * @param y2	the y coordinate of the other endpoint of the segment
	 * @param x		the x coordinate of the point
	 * @param y		the y coordinate of the point
	 * @return		the distance from one point to a segment (not a line)
	 */
	public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
		if(cross <= 0)
		{
			return (x - x1) * (x - x1) + (y - y1) * (y - y1);
		}
		double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
		if(cross >= d)
		{
			return (x - x2) * (x - x2) + (y - y2) * (y - y2);
		}
		double r = cross / d;
		double px = x1 + (x2 - x1) * r;
		double py = y1 + (y2 - y1) * r;
		return (x - px) * (x - px) + (y - py) * (y - py);
	}

	/**
	 * 4---KMP match, i.e. kmpMatch("abcd", "bcd") = 1, kmpMatch("abcd", "bfcd") = -1.
	 * @param t:	String to match.
	 * @param p:	String to be matched.
	 * @return		if can match, first index; otherwise -1.
	 */
	public int kmpMatch(char[] t, char[] p)
	{
		int n = t.length;
		int m = p.length;
		int[] next = new int[m + 1];
		next[0] = -1;
		int j = -1;
		for(int i = 1;i < m;++i)
		{
			while(j >= 0 && p[i] != p[j + 1])
			{
				j = next[j];
			}
			if(p[i] == p[j + 1])
			{
				++j;
			}
			next[i] = j;
		}
		j = -1;
		for(int i = 0;i < n;++i)
		{
			while(j >= 0 && t[i] != p[j + 1])
			{
				j = next[j];
			}
			if(t[i] == p[j + 1])
			{
				++j;
			}
			if(j == m - 1)
			{
				return i - m + 1;
			}
		}
		return -1;
	}

	/**
	 * 5---Get the hash code of a String
	 * @param	s:	input string
	 * @return	hash code
	 */
	public long hash(String s)
	{
		long key = 0, t = 1;
		for(int i = 0;i < s.length();++i)
		{
			key = (key + s.charAt(i) * t) % MODH;
			t = t * BASE % MODH;
		}
		return key;
	}

	/**
	 * 6---Get x ^ n % MOD quickly.
	 * @param	x:	base
	 * @param 	n:	times
	 * @return	x ^ n % MOD
	 */
	public long quickMod(long x, long n)
	{
		long ans = 1;
		while(n > 0)
		{
			if(1 == n % 2)
			{
				ans = ans * x % MOD;
 			}
			x = x * x % MOD;
			n >>= 1;
		}
		return ans;
	}

	/**
	 * 7---judge if a point is located inside a polygon
	 * @param x0	the x coordinate of the point
	 * @param y0	the y coordinate of the point
	 * @return true if it is inside the polygon, otherwise false
	 */
	/*public boolean contains(double x0, double y0)
	{
		int cross = 0;
		for(int i = 0;i < n;++i)
		{
			double s = x[i + 1] == x[i] ? 100000000 : (double)(y[i + 1] - y[i]) / (x[i + 1] - x[i]);
			boolean b1 = x[i] <= x0 && x0 < x[i + 1];
			boolean b2 = x[i + 1] <= x0 && x0 < x[i];
			boolean b3 = y0 < s * (x0 - x[i]) + y[i];
			if((b1 || b2) && b3) ++cross;
		}
		return cross % 2 != 0;
	}*/

	/**
	 * 8---judge if a point is located on the segment
	 * @param	x1	the x coordinate of one point of the segment
	 * @param	y1	the y coordinate of one point of the segment
	 * @param 	x2	the x coordinate of another point of the segment
	 * @param 	y2	the y coordinate of another point of the segment
	 * @param	x	the x coordinate of the point
	 * @param 	y	the y coordinate of the point
	 * @return	true if it is located on the segment, otherwise false
	 */
	public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&
				x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&
				y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
	}

	/**
	 * 9---get the cross product
	 * @param 	p1	point A
	 * @param 	p2	point B
	 * @param 	p	point O
	 * @return	cross product of OA x OB
	 */
	public long cross(Point p1, Point p2, Point p)
	{
		return (long)(p1.x - p.x) * (p2.y - p.y) - (long)(p2.x - p.x) * (p1.y - p.y);
	}

	class MyScanner
	{
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    BufferedInputStream bis = new BufferedInputStream(System.in);

	    public int read()
	    {
	        if (-1 == numChars)
	        {
	        	throw new InputMismatchException();
	        }
	        if (curChar >= numChars)
	        {
	            curChar = 0;
	            try
	            {
	                numChars = bis.read(buf);
	            }
	            catch (IOException e)
	            {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	            {
	            	return -1;
	            }
	        }
	        return buf[curChar++];
	    }

	    public int nextInt()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do
	        {
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong()
	    {
	    	int c = read();
	    	while (isSpaceChar(c))
	    	{
	    		c = read();
	    	}
	    	int sgn = 1;
	    	if (c == '-')
	    	{
	    		sgn = -1;
	    		c = read();
	    	}
	    	long res = 0;
	    	do
	    	{
	    		if (c < '0' || c > '9')
	    		{
	    			throw new InputMismatchException();
	    		}
	    		res *= 10;
	    		res += c - '0';
	    		c = read();
	    	} while (!isSpaceChar(c));
	    	return res * sgn;
	    }

	    public double nextDouble()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.')
	        {
	            if (c == 'e' || c == 'E')
	            {
	            	return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c & 15;
	            c = read();
	        }
	        if (c == '.')
	        {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c))
	            {
	                if (c == 'e' || c == 'E')
	                {
	                	return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9')
	                {
	                	throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c & 15) * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public String next()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        StringBuilder res = new StringBuilder();
	        do
	        {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    private boolean isSpaceChar(int c)
	    {
	        return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;
	    }
	}
}

/**
 * Created by Anna.Skobaneva on 1/17/14.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class TaskB {

    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws NumberFormatException,
            IOException {
        TaskB solver = new TaskB();
        solver.open();
        long time = System.currentTimeMillis();
        solver.solve();
        if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {
            System.out.println("Spent time: "
                    + (System.currentTimeMillis() - time));
            System.out.println("Memory: "
                    + (Runtime.getRuntime().totalMemory() - Runtime
                    .getRuntime().freeMemory()));
        }
        solver.close();
    }

    public void open() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter(new FileWriter("output.txt"));
    }

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null)
                return null;
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

    boolean hasMoreTokens() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null)
                return false;
            st = new StringTokenizer(line);
        }
        return true;
    }

    class Pair {
        int cnt;
        int value;

        Pair(int cnt, int value) {
            this.cnt = cnt;
            this.value = value;
        }
    }

    public void solve() throws NumberFormatException, IOException {
        long a = nextLong();
        long b = nextLong();
        long w = nextLong();
        long x = nextLong();
        long c = nextLong();

        out.println((long)Math.ceil((-b + (c - a) * x + 0.0) / (w - x)) + c - a);
    }

    public void close() {
        out.flush();
        out.close();
    }
}

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Agostinho Junior
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
	OutputWriter out;
	InputReader in;
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		this.in = in; this.out = out;
		int a = in.readInt();
		int b = in.readInt();
		int w = in.readInt();
		int x = in.readInt();
		int d = in.readInt() - a;
		final int N = 2000;
		int[] lastTime = new int[N];
		int[] lastD = new int[N];
		int time = 0;
		while (d > 0) {
			if (x <= b) {
				int diff = Math.min((b - x) / x + 1, d);
				time += Math.min(d, diff);
				d -= diff;
				b -= x * diff;
				if (lastTime[b] > 0) {
					diff = d / (lastD[b] - d);
					d -= diff * (lastD[b] - d);
					time += diff * (time - lastTime[b]);
				}
			} else {
				b += w - x;
				time++;
			}
			lastTime[b] = time;
			lastD[b] = d;
		}
		out.println(time);
	}
}

class OutputWriter {
	private PrintWriter output;
	public OutputWriter() {
		this(System.out);
	}
	public OutputWriter(OutputStream out) {
		output = new PrintWriter(out);
	}
	public OutputWriter(Writer writer) {
		output = new PrintWriter(writer);
	}
	public void println(Object o) {
		output.println(o);
	}
	public void close() {
		output.close();
	}
}

class InputReader {
	private BufferedReader input;
	private StringTokenizer line = new StringTokenizer("");
	public InputReader() {
		this(System.in);
	}
	public InputReader(InputStream in) {
		input = new BufferedReader(new InputStreamReader(in));
	}
	public InputReader(String s) {
		try {
			input = new BufferedReader(new FileReader(s));
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public void fill() {
		try {
			if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public int readInt() {
		fill();
		return Integer.parseInt(line.nextToken());
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class B {

    static int compute(int a, int b, int w, int x, int c) {
        if(a>=c) {
            return 0;
        }

        int[] len=new int[w];
        int[] dec=new int[w];
        Arrays.fill(len, -1);
        Arrays.fill(dec, -1);

        int l=0, d=0, plen, pdec, clen, cdec;
        while(true) {
            if(len[b]<0) {
                len[b]=l;
                dec[b]=d;
            } else {
                plen=len[b]; pdec=dec[b];
                clen=l-plen; cdec=d-pdec;
                break;
            }
            if(b>=x) {
                int k=b/x;
                b=b%x;
                l+=k;
            } else {
                b=w-(x-b);
                l++;
                d++;
            }
        }

        if(a-pdec>=c-plen) {
            return compute2(a, b, w, x, c);
        } else {
            a-=pdec; c-=plen;
            int k=(c-a)/(clen-cdec)-1;
            a-=cdec*k; c-=clen*k;
            return k*clen+compute2(a, b, w, x, c);
        }
    }

    static int compute2(int a, int b, int w, int x, int c) {
        int ret=0;
        if(a>=c) {
            return 0;
        } else {
            while(true) {
                if(b>=x) {
                    int k=b/x;
                    if(c-a<=k) {
                        return ret+(c-a);
                    }
                    c-=k;
                    b=b%x;
                    ret+=k;
                } else {
                    c--;
                    a--;
                    b=w-(x-b);
                    ret++;
                }
            }
        }
    }

    static void run_stream(InputStream ins) throws IOException {
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        String[] s=r.readLine().split(" ");

        System.out.println(compute(
            Integer.parseInt(s[0]),
            Integer.parseInt(s[1]),
            Integer.parseInt(s[2]),
            Integer.parseInt(s[3]),
            Integer.parseInt(s[4])));
    }

    public static void main(String[] args) throws IOException {
        run_stream(System.in);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;

public class B {

    static int compute(int a, int b, int w, int x, int c) {
        int b0=b;
        if(a>=c) {
            return 0;
        }

        int[] len=new int[w];
        int[] dec=new int[w];
        Arrays.fill(len, -1);
        Arrays.fill(dec, -1);

        int l=0, d=0, plen, pdec, clen, cdec;
        while(true) {
            if(len[b]<0) {
                len[b]=l;
                dec[b]=d;
            } else {
                plen=len[b]; pdec=dec[b];
                clen=l-plen; cdec=d-pdec;
                break;
            }
            if(b>=x) {
                int k=b/x;
                b=b%x;
                l+=k;
            } else {
                b=w-(x-b);
                l++;
                d++;
            }
        }

        if(a-pdec>=c-plen) {
            return compute2(a, b0, w, x, c);
        } else {
            a-=pdec; c-=plen;
            int k=(c-a)/(clen-cdec);
            if(k>0) {
                k--;
            }
            a-=cdec*k; c-=clen*k;
            return plen+k*clen+compute2(a, b, w, x, c);
        }
    }

    static int compute2(int a, int b, int w, int x, int c) {
        int ret=0;
        if(a>=c) {
            return 0;
        } else {
            while(true) {
                if(b>=x) {
                    int k=b/x;
                    if(c-a<=k) {
                        return ret+(c-a);
                    }
                    c-=k;
                    b=b%x;
                    ret+=k;
                } else {
                    c--;
                    a--;
                    b=w-(x-b);
                    ret++;
                }
            }
        }
    }

    static void run_stream(InputStream ins) throws IOException {
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        String[] s=r.readLine().split(" ");

        int a=Integer.parseInt(s[0]);
        int b=Integer.parseInt(s[1]);
        int w=Integer.parseInt(s[2]);
        int x=Integer.parseInt(s[3]);
        int c=Integer.parseInt(s[4]);
        System.out.println(compute(a,b,w,x,c));
        //System.out.println(compute2(a,b,w,x,c));
    }

    public static void main(String[] args) throws IOException {
        run_stream(System.in);

        //run_random();
    }

    static Random rnd=new Random();
    static void run_random() {
        for (int i=0; i<100; i++) {
            int a=rnd.nextInt(100)+1;
            int b=rnd.nextInt(20)+1;
            int x=rnd.nextInt(20)+1;
            int w=Math.max(b, x)+rnd.nextInt(100);
            int c=a+rnd.nextInt(200);

            int r1=compute(a,b,w,x,c);
            int r2=compute2(a,b,w,x,c);

            if(r1!=r2) {
                System.out.println(a+" "+b+" "+w+" "+x+" "+c);
            }
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class B {

    static int compute(int a, int b, int w, int x, int c) {
        if(a>=c) {
            return 0;
        }

        int[] len=new int[w];
        int[] dec=new int[w];
        Arrays.fill(len, -1);
        Arrays.fill(dec, -1);

        int l=0, d=0, plen, pdec, clen, cdec;
        while(true) {
            if(len[b]<0) {
                len[b]=l;
                dec[b]=d;
            } else {
                plen=len[b]; pdec=dec[b];
                clen=l-plen; cdec=d-pdec;
                break;
            }
            if(b>=x) {
                int k=b/x;
                b=b%x;
                l+=k;
            } else {
                b=w-(x-b);
                l++;
                d++;
            }
        }

        if(a-pdec>=c-plen) {
            return compute2(a, b, w, x, c);
        } else {
            a-=pdec; c-=plen;
            int k=(c-a)/(clen-cdec);
            if(k>0) {
                k--;
            }
            a-=cdec*k; c-=clen*k;
            return k*clen+compute2(a, b, w, x, c);
        }
    }

    static int compute2(int a, int b, int w, int x, int c) {
        int ret=0;
        if(a>=c) {
            return 0;
        } else {
            while(true) {
                if(b>=x) {
                    int k=b/x;
                    if(c-a<=k) {
                        return ret+(c-a);
                    }
                    c-=k;
                    b=b%x;
                    ret+=k;
                } else {
                    c--;
                    a--;
                    b=w-(x-b);
                    ret++;
                }
            }
        }
    }

    static void run_stream(InputStream ins) throws IOException {
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        String[] s=r.readLine().split(" ");

        System.out.println(compute(
            Integer.parseInt(s[0]),
            Integer.parseInt(s[1]),
            Integer.parseInt(s[2]),
            Integer.parseInt(s[3]),
            Integer.parseInt(s[4])));
    }

    public static void main(String[] args) throws IOException {
        run_stream(System.in);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class B {

    static int compute(int a, int b, int w, int x, int c) {
        if(a>=c) {
            return 0;
        }

        int[] len=new int[w];
        int[] dec=new int[w];
        Arrays.fill(len, -1);
        Arrays.fill(dec, -1);

        int l=0, d=0, plen, pdec, clen, cdec;
        while(true) {
            if(len[b]<0) {
                len[b]=l;
                dec[b]=d;
            } else {
                plen=len[b]; pdec=dec[b];
                clen=l-plen; cdec=d-pdec;
                break;
            }
            if(b>=x) {
                int k=b/x;
                b=b%x;
                l+=k;
            } else {
                b=w-(x-b);
                l++;
                d++;
            }
        }

        if(a-pdec>=c-plen) {
            return compute2(a, b, w, x, c);
        } else {
            a-=pdec; c-=plen;
            int k=(c-a)/(clen-cdec);
            if(k>0) {
                k--;
            }
            a-=cdec*k; c-=clen*k;
            return plen+k*clen+compute2(a, b, w, x, c);
        }
    }

    static int compute2(int a, int b, int w, int x, int c) {
        int ret=0;
        if(a>=c) {
            return 0;
        } else {
            while(true) {
                if(b>=x) {
                    int k=b/x;
                    if(c-a<=k) {
                        return ret+(c-a);
                    }
                    c-=k;
                    b=b%x;
                    ret+=k;
                } else {
                    c--;
                    a--;
                    b=w-(x-b);
                    ret++;
                }
            }
        }
    }

    static void run_stream(InputStream ins) throws IOException {
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        String[] s=r.readLine().split(" ");

        int a=Integer.parseInt(s[0]);
        int b=Integer.parseInt(s[1]);
        int w=Integer.parseInt(s[2]);
        int x=Integer.parseInt(s[3]);
        int c=Integer.parseInt(s[4]);
        System.out.println(compute(a,b,w,x,c));
        //System.out.println(compute2(a,b,w,x,c));
    }

    public static void main(String[] args) throws IOException {
        run_stream(System.in);
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Hashtable;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        Hashtable<Integer, Integer> table = new Hashtable<Integer, Integer>();
        int i;
        int a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();
        if(a >= c) {
            out.printLine(0);
            return;
        }
        int k = b, time = 0, p = 0, q = 0;
        table.put(k, 0);
        while (true) {
            if(a - p >= c - time) {
                out.printLine(time);
                return;
            }
            time++;

            if(k >= x) {
                k -= x;
            }
            else {
                k += (w - x);
                p++;
            }
            if(table.containsKey(k)) {
                q = time;
                break;
            }
            table.put(k, time);
            //DebugUtils.print(a - p, c - time, time, k);
        }
        int value = k, r = time;
        a-= p;
        c -= q;
        p = 0;
        q = 0;
        time = 0;
        //DebugUtils.print(a, c, time, k);

        while (true) {
            if(a - p >= c - time) {
                out.printLine(time + r);
                return;
            }
            time++;
            if(k >= x) {
                k -= x;

            }
            else {
                k += (w - x);
                p++;
            }
            if(k == value) {
                q = time;
                break;
            }
        }
        //DebugUtils.print(c, a, q, p);
        if((c - a) % (q - p) == 0) {
            int cycles = (c - a) / (q - p) - 1;
            r += time * cycles;
            a -= p * cycles;
            c -= q * cycles;
            k = value;
            time = 0;
            while (true) {
                if(a >= c) {
                    out.printLine(time + r);
                    return;
                }
                time++;
                c--;
                if(k >= x) {
                    k -= x;

                }
                else {
                    k += (w - x);
                    a--;
                }
            }
        } else {
            int cycles = (c - a) / (q - p);
            r += time * cycles;
            a -= p * cycles;
            c -= q * cycles;
            k = value;
            time = 0;
            while (true) {
                if(a >= c) {
                    out.printLine(time + r);
                    return;
                }
                time++;
                c--;
                if(k >= x) {
                    k -= x;

                }
                else {
                    k += (w - x);
                    a--;
                }
            }
        }
    }
}

class InputReader
{
    BufferedReader in;
    StringTokenizer tokenizer=null;

    public InputReader(InputStream inputStream)
    {
        in=new BufferedReader(new InputStreamReader(inputStream));
    }
    public String next()
    {
        try{
            while (tokenizer==null||!tokenizer.hasMoreTokens())
            {
                tokenizer=new StringTokenizer(in.readLine());
            }
            return tokenizer.nextToken();
        }
        catch (IOException e)
        {
            return null;
        }
    }
    public int nextInt()
    {
        return Integer.parseInt(next());
    }
    }

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}
}

import java.io.*;
import java.util.*;

public class cf382b {
  static FastIO in = new FastIO(), out = in;

  public static void main(String[] args) {
    long a = in.nextInt();
    long b = in.nextInt();
    long w = in.nextInt();
    long x = in.nextInt();
    long c = in.nextInt();

    long lo = 0, hi = (long)1e15;
    while(hi - lo > 2) {
      long mid = (hi+lo)/2;
      if(ok(a,b,w,x,c,mid)) hi = mid;
      else lo = mid;
    }
    while(!ok(a,b,w,x,c,lo)) lo++;
    out.println(lo);
    out.close();
  }
  static boolean ok(long a, long b, long w, long x, long c, long t) {
    a = a - (b + t*x - w + 1)/w;
    c = c - t;
    return c <= a;
  }

  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in, System.out);
    }

    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }

    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }

    public int numTokens() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }

    public String next() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nipuna Samarasekara
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
   /////////////////////////////////////////////////////////////
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        long a=in.nextLong();
        long b=in.nextLong();
        long w=in.nextLong();
        long x=in.nextLong();
        long c=in.nextLong();
        long s=w-x;
        long gap=c-a;
        long ans=0;
        if(gap<=0){
            out.println(0);
            return;
        }
        if(b>=x){
            gap-= b/x;
            ans+=b/x;
            b%=x;
        }
        if(gap<=0){
            ans+=gap;
            out.println(ans);
            return;
        }
        System.out.println(gap);
        long[] red = new long[(int)x];
        long[] bval = new long[(int)x];
        long[] inct = new long[(int)x];
        for (int i = 0; i < x; i++) {
            long hh= (x-i+s-1)/s;
            long bn=i+hh*s;
            inct[i]=hh;
            red[i]=bn/x;
            bval[i]=bn%x;
        }
        long addt=0;
        long cycle=0;
        long sb=b,bb=b;
        cycle+=red[(int)sb];
        sb=bval[(int)sb];
        addt+=inct[(int)sb];
        while(sb!=bb){
            cycle+=red[(int)sb];
            sb=bval[(int)sb];
            addt+=inct[(int)sb];
        }
        long jj=gap/cycle;
        ans+=jj*cycle;
        gap%=cycle;
        ans+=jj*addt;
        sb=bb;
        while(gap>0){
            ans+=inct[(int)sb];
            gap-=red[(int)sb];
            ans+=red[(int)sb];

            sb=bval[(int)sb];

        }
        ans+=gap;
        out.println(ans);

    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        if (c < 0) {
            return null;
        }
        while (c >= 0 && !isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    }

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

    public FastPrinter(Writer out) {
        super(out);
    }

}

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		B solver = new B();
		solver.solve(1, in, out);
		out.close();
	}
}

class B {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        long a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        long c = in.nextInt();
        int[] to = new int[w];
        Graph g = new Graph(w, w);
        for (int i = w - 1, j = i - x; i >= 0; i--, j = j == 0 ? w - 1 : j - 1) {
//            System.err.println(i + " to " + j);
            to[i] = j;
            g.addDirectedWeightedEdge(i, j, i > j ? 0 : -1);
        }
        BellmanFord bf = new BellmanFord(g);
        bf.getDist(b);
        long moves = 0;
//        System.err.println("Cycle start: " + bf.cycleStart);
        while (b != bf.cycleStart && c > a) {
//            System.err.println("At " + b + " with curr A of " + a);
            a += g.cost.get(g.edges[b].peek());
            b = to[b];
            c--;
            moves++;
        }
        if (c <= a) {
            out.println(moves);
            return;
        }
        int cycleCost = 0;
        int cycleLength = 0;
        int curr = b;
        do {
            cycleLength++;
            curr = to[curr];
            if (curr < to[curr]) {
                cycleCost--;
            }
        } while (curr != b);
        long cycles = 0;
        for (int i = 50; i >= 0; i--) {
            long aDiff = cycleCost * (1L << i);
            long cDiff = cycleLength * (1L << i);
            if (a - aDiff < c - cDiff) {
                a -= aDiff;
                c -= cDiff;
                cycles = 1L << i;
            }
        }
//        System.err.println("Cycles: " + cycles);
        moves += cycles * cycleLength;
        while (c > a) {
//            System.err.println("At " + b + " with curr A of " + a);
            a += g.cost.get(g.edges[b].peek());
            b = to[b];
            c--;
            moves++;
        }
        out.println(moves);
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

class Graph {

    public IntArrayList to;
    public IntArrayList capacity;
    public IntArrayList cost;
    public IntArrayList reverse;
    public IntDeque edges[];
    public int vertexCount;
    public int edgeCount;
    public int inDegree[];
    public int outDegree[];

    public Graph(int vertexCount) {
        this(vertexCount, 16);
    }

    public Graph(int vertexCount, int edgeCount) {
        this.to = new IntArrayList(edgeCount);
        this.capacity = new IntArrayList(edgeCount);
        this.cost = new IntArrayList(edgeCount);
        this.reverse = new IntArrayList(edgeCount);
        this.edges = new IntDeque[vertexCount];
        this.vertexCount = vertexCount;
        this.edgeCount = 0;
        this.inDegree = new int[vertexCount];
        this.outDegree = new int[vertexCount];
        for (int i = 0; i < vertexCount; i++) {
            edges[i] = new IntDeque();
        }
    }

    public void addDirectedWeightedEdge(int u, int v, int edgeCost) {
        to.add(v);
        capacity.add(0);
        cost.add(edgeCost);
        reverse.add(-1);
        edges[u].add(edgeCount++);
        inDegree[v]++;
        outDegree[u]++;
    }

    }

class BellmanFord {

    public final long INFINITY = Long.MAX_VALUE;
    public long[] dist;
    public int[] prev;
    boolean[] enqueued;
    public boolean hasCycle;
    public int cycleStart;
    Graph g;

    public BellmanFord(Graph g) {
        dist = new long[g.vertexCount];
        prev = new int[g.vertexCount];
        enqueued = new boolean[g.vertexCount];
        this.g = g;
    }
    public long[] getDist(int src) {
        Arrays.fill(dist, INFINITY);
        hasCycle = false;
        IntDeque q = new IntDeque();

        dist[src] = 0;
        q.add(src);
        for (int i = 0; i < g.vertexCount - 1; i++) {
            for (int v: q) {
                enqueued[v] = false;
            }
            int size = q.size();
            for (int s = 0; s < size; s++) {
                int u = q.poll();
                for (int edge: g.edges[u]) {
                    int v = g.to.get(edge);
                    if (dist[v] > dist[u] + g.cost.get(edge)) {
                        dist[v] = dist[u] + g.cost.get(edge);
                        prev[v] = u;
                        if (!enqueued[v]) {
                            enqueued[v] = true;
                            q.add(v);
                        }
                    }
                }
            }
        }

        CycleCheck: for (int u = 0; u < g.vertexCount; u++) {
            for (int edge: g.edges[u]) {
                int v = g.to.get(edge);
                if (dist[v] > dist[u] + g.cost.get(edge)) {
                    cycleStart = v;
                    hasCycle = true;
                    break CycleCheck;
                }
            }
        }
        return dist;
    }

}

class IntArrayList {
    int size = 0;
    int[] array;
    public IntArrayList() {
        this(16);
    }
    public IntArrayList(int length) {
        array = new int[length];
    }
    public void ensureCapacity() {
        if (size == array.length) {
            int[] newArray = new int[size << 1];
            System.arraycopy(array, 0, newArray, 0, size);
            array = newArray;
        }
    }
    public void add(int element) {
        ensureCapacity();
        array[size] = element;
        size++;
    }
    private void checkIndex(int index) {
        if (index < 0 || index >= size) {
            throw new IndexOutOfBoundsException();
        }
    }
    public int get(int index) {
        checkIndex(index);
        return array[index];
    }
    }

class IntDeque implements Iterable<Integer> {

    private int capacity;
    private int size = 0;
    private int front = 0;
    private int back = 0;
    private int[] deque;
    public IntDeque() {
        this(100);
    }
    public IntDeque(int capacity) {
        this.capacity = capacity;
        deque = new int[capacity];
    }
    public void add(int x) {
        addLast(x);
    }
    public void addLast(int x) {
        ensureCapacity();
        size++;
        deque[back++] = x;
        if (back == capacity) {
            back = 0;
        }
    }
    public void ensureCapacity() {
        if (size < capacity) {
            return;
        }
        int[] newDeque = new int[capacity << 1];
        for (int i = 0, j = front; i < size; i++, j++) {
            if (j == capacity) {
                j = 0;
            }
            newDeque[i] = deque[j];
        }
        deque = newDeque;
        capacity <<= 1;
        front = 0;
        back = size;
    }
    public Iterator<Integer> iterator() {
        return new Iterator<Integer>() {
            int done = 0;
            int curr = front;
            public boolean hasNext() {
                return done < size;
            }
            public Integer next() {
                Integer res = deque[curr++];
                if (curr == capacity) {
                    curr = 0;
                }
                done++;
                return res;
            }
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
    public int peek() {
        return peekFirst();
    }
    public int peekFirst() {
        return deque[front];
    }
    public int poll() {
        return pollFirst();
    }
    public int pollFirst() {
        if (size == 0) {
            throw new RuntimeException("IntDeque is empty!");
        }
        size--;
        int res = deque[front++];
        if (front == capacity) {
            front = 0;
        }
        return res;
    }
    public int size() {
        return size;
    }
    public String toString() {
        if (size == 0) {
            return "";
        }
        StringBuilder res = new StringBuilder();
        for (int i: this) {
            res.append(i);
            res.append(" ");
        }
        res.setLength(res.length() - 1);
        return res.toString();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class NumberBusters {

    public static void main(String[]args) throws IOException{

while(true){

    if(!skp())break;

    int a = nextInt();
    int b = nextInt();
    int w = nextInt();
    int x = nextInt();
    int c = nextInt();

    long hi = (long) 10E18;
    long lo = 0 ;
    for(int i = 0 ; i < 60 ; i++){

    long mid = lo + (hi-lo)/2;
    long a1 = a-    (long) Math.ceil((b-mid*x)/(w*-1.0));
        long c1= c-mid;
        if(c1<=a1)hi = mid;
        else lo = mid+1;

    }

    System.out.println(lo);

}

        }

    static boolean skp() throws IOException{
        String line = r.readLine();
        if(line == null)return false;
        tkn = new StringTokenizer(line);
        return true;
    }

    static int nextInt(){
        return Integer.parseInt(tkn.nextToken());
    }
    static int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(r.readLine());
    }
    static long nextLong(){
        return Long.parseLong(tkn.nextToken());
    }
    static long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(r.readLine());
    }

    static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tkn ;

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class NumberBusters {

    public static void main(String[]args) throws IOException{

while(true){

    if(!skp())break;

    int a = nextInt();
    int b = nextInt();
    int w = nextInt();
    int x = nextInt();
    int c = nextInt();

    long hi = 1000000000;
    long lo = 0 ;
    for(int i = 0 ; i < 170 ; i++){

    long mid = lo + (hi-lo)/2;
    long a1 = a-    (long) Math.ceil((b-mid*x)/(w*-1.0));
        long c1= c-mid;
        if(c1<=a1)hi = mid;
        else lo = mid+1;

    }

    System.out.println(lo);

}

        }

    static boolean skp() throws IOException{
        String line = r.readLine();
        if(line == null)return false;
        tkn = new StringTokenizer(line);
        return true;
    }

    static int nextInt(){
        return Integer.parseInt(tkn.nextToken());
    }
    static int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(r.readLine());
    }
    static long nextLong(){
        return Long.parseLong(tkn.nextToken());
    }
    static long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(r.readLine());
    }

    static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tkn ;

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class B {

	static PrintWriter out;
	static InputReader in;
	public static void main(String[] args) throws Exception {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);

		long a = in.nextLong();
		long b = in.nextLong();
		long w = in.nextLong();
		long x = in.nextLong();
		long c = in.nextLong();

		if(c <= a){
			out.println(0);
			out.close();
			return;
		}
		// search last highest c > a
		long lo = 0;
		long hi = Integer.MAX_VALUE;
		while(lo < hi) {
			long mid = (lo+hi+1)/2;
			long newc = c - mid;

			// b - mid * x, need how many + w to be >= 0?
			long need = 0;
			if(b - mid * x >= 0) {
				need = 0;
			} else {
				need = - (b - mid * x) / w;
				while(b - mid * x + need  * w < 0){
					need++;
				}

				while(b - mid * x + need  * w >= w){
					need--;
				}
			}
			long newa = a - need;
			if(newc > newa){
				lo = mid;
			}else{
				hi = mid-1;
			}
		}
		out.println(lo+1);
		out.close();
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class B {

	static PrintWriter out;
	static InputReader in;
	public static void main(String[] args) throws Exception {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);

		long a = in.nextLong();
		long b = in.nextLong();
		long w = in.nextLong();
		long x = in.nextLong();
		long c = in.nextLong();

		if(c <= a){
			out.println(0);
			out.close();
			return;
		}
		// search last highest c > a
		long lo = 0;
		long hi = Integer.MAX_VALUE/2;
		while(lo < hi) {
			long mid = (lo+hi+1)/2;
			long newc = c - mid;

			// b - mid * x, need how many + w to be >= 0?
			long need = 0;
			if(b - mid * x >= 0) {
				need = 0;
			} else {
				need = - (b - mid * x) / w;
				while(b - mid * x + need  * w < 0){
					need++;
				}

				while(b - mid * x + need  * w >= w){
					need--;
				}
			}
			long newa = a - need;
			if(newc > newa){
				lo = mid;
			}else{
				hi = mid-1;
			}
		}
		out.println(lo+1);
		out.close();
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.util.*;
public class Ganesha {

  public static void main (String [] args){

  	Scanner in = new Scanner(System.in);

  	 long a = in.nextLong();
  	 long b = in.nextLong();
  	 long w = in.nextLong();
  	 long x = in.nextLong();
  	 long c = in.nextLong();
  	  w=w-x;

  	 if(c<=a)
  	 	System.out.print("0");

  	 	else if(c>a){
  	 		if(b>=(c-a)*x)
  	 			System.out.print((c-a));

  	 			else{
                    System.out.print((c-a +(int)Math.ceil((double)(((c-a)*x-b))/w)));

  	 			}

  	 	}
  }
  }

 import java.util.*;
public class Ganesha {

  public static void main (String [] args){

  	Scanner in = new Scanner(System.in);

  	 long a = in.nextLong();
  	 long b = in.nextLong();
  	 long w = in.nextLong();
  	 long x = in.nextLong();
  	 long c = in.nextLong();
  	  w=w-x;

  	 if(c<=a)
  	 	System.out.print("0");

  	 	else if(c>a){
  	 		if(b>=(c-a)*x)
  	 			System.out.print((c-a));

  	 			else{
                    System.out.print((c-a +Math.ceil((double)(((c-a)*x-b))/w)));

  	 			}

  	 	}
  }
  }

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int _a, _b, _w, _x, _c;

    public static void main(String[] args) {
        NumberBusters busters = new NumberBusters();
        busters.read();
        busters.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] s = br.readLine().split(" ");
            this._a = Integer.parseInt(s[0]);
            this._b = Integer.parseInt(s[1]);
            this._w = Integer.parseInt(s[2]);
            this._x = Integer.parseInt(s[3]);
            this._c = Integer.parseInt(s[4]);
        } catch (Exception e) {
        }

    }

    void solve() {
        if (_c <= _a) {
            System.out.println(0);
            return;
        }

        int times = 0;
        int a = _a;
        int b = _b;
        int prevB = b;
        int c = _c;
        int cntA = 0;
        do {
            times++;
            c--;

            if (b >= _x) {
                b = b - _x;
            } else {
                cntA++;
                a--;

                b = _w - (_x - b);
            }
//          System.out.println("c:" + c + " a:" + a);
        } while (c > a && b != prevB);

        if (c <= a) {
            System.out.println(times);
        } else {
            int diff = times - cntA;
            int num = (c - a - 1) / diff;
//          System.out.println("dif:" + diff + " c - a:" + (c - a));
//          System.out.println("\ttimes" + times);
            c -= num * times;
            a -= num * cntA;
            times += num * times;
            while (c > a) {
//          System.out.println("c:" + c + " a:" + a);
                times++;
                c--;

                if (b >= _x) {
                    b = b - _x;
                } else {
                    a--;

                    b = _w - (_x - b);
                }
            }

            System.out.println(times);
        }

        return;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int a, b, w, x, c;

    public static void main(String[] args) {
        NumberBusters nb = new NumberBusters();
        nb.read();
        nb.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] strs = br.readLine().split(" ");
            a = Integer.parseInt(strs[0]);
            b = Integer.parseInt(strs[1]);
            w = Integer.parseInt(strs[2]);
            x = Integer.parseInt(strs[3]);
            c = Integer.parseInt(strs[4]);
        } catch (Exception e) {
            // TODO: handle exception
        }
    }

    void solve() {
        int res = 0;
//      int cnt = 0;
        while (c > a) {
//          if (cnt++ > 10) break;
//          System.out.println("a:" + a + " b:" + b + " w:" + w + " x:" + x + " c:" + c );
            if (b >= x) {
                int subtract = b - x;
                int num = subtract / x + 1;
                if (c - num <= a) {
                    for (int i = 0; i < num; i++) {
                        c -= 1;
                        res++;

                        if (c <= a) break;
                    }
                } else {
                    res += num;
                    c -= num;
                    b = b - x * num;
                }
            } else {
                int subtract = w - x;
                int num = (x - b) / subtract;
                if (num == 0) num++;

                a -= num;
                c -= num;
                b += num * subtract;
                res += num;
            }
        }

        System.out.println(res);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int _a, _b, _w, _x, _c;

    public static void main(String[] args) {
        NumberBusters busters = new NumberBusters();
        busters.read();
        busters.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] s = br.readLine().split(" ");
            this._a = Integer.parseInt(s[0]);
            this._b = Integer.parseInt(s[1]);
            this._w = Integer.parseInt(s[2]);
            this._x = Integer.parseInt(s[3]);
            this._c = Integer.parseInt(s[4]);
        } catch (Exception e) {
        }

    }

    void solve() {
        if (_c <= _a) {
            System.out.println(0);
            return;
        }

        int times = 0;
        int a = _a;
        int b = _b;
        int prevB = b;
        int c = _c;
        int cntA = 0;
        do {
            times++;
            c--;

            if (b >= _x) {
                prevB = b;
                b = b - _x;
            } else {
                cntA++;
                a--;

                prevB = b;
                b = _w - (_x - b);
            }
            System.out.println("c:" + c + " a:" + a);
        } while (c > a && b != prevB);

        if (c <= a) {
            System.out.println(times);
        } else {
            int num = c / (times - cntA);
            int rem = c % (times - cntA);
            c -= num * times;
            a -= num * cntA;
            times += num * times;
            do {
                times++;
                c--;

                if (b >= _x) {
                    prevB = b;
                    b = b - _x;
                } else {
                    cntA++;
                    a--;

                    prevB = b;
                    b = _w - (_x - b);
                }

            } while (c > a || b != prevB);
            System.out.println(times);
        }

        return;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int a, b, w, x, c;

    public static void main(String[] args) {
        NumberBusters nb = new NumberBusters();
        nb.read();
        nb.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] strs = br.readLine().split(" ");
            a = Integer.parseInt(strs[0]);
            b = Integer.parseInt(strs[1]);
            w = Integer.parseInt(strs[2]);
            x = Integer.parseInt(strs[3]);
            c = Integer.parseInt(strs[4]);
        } catch (Exception e) {
            // TODO: handle exception
        }
    }

    void solve() {
        int res = 0;
//      int cnt = 0;
        while (c > a) {
//          if (cnt++ > 10) break;
//          System.out.println("a:" + a + " b:" + b + " w:" + w + " x:" + x + " c:" + c );
            if (b >= x) {
//              b -= x;
//              c--;
//              res++;
                int subtract = b - x;
                int num = subtract / x + 1;
                if (c - num <= a) {
                    for (int i = 0; i < num; i++) {
                        c -= 1;
                        res++;

                        if (c <= a) break;
                    }
                } else {
                    res += num;
                    c -= num;
                    b = b - x * num;
                }
            } else {
                int subtract = w - x;
                int num = (x - b) / subtract;
                int sub2 = (x - b) - subtract * num;
                if (sub2 != 0) num++;

                a -= num;
                c -= num;
                b += num * subtract;
                res += num;
            }
        }

        System.out.println(res);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int a, b, w, x, c;

    public static void main(String[] args) {
        NumberBusters nb = new NumberBusters();
        nb.read();
        nb.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] strs = br.readLine().split(" ");
            a = Integer.parseInt(strs[0]);
            b = Integer.parseInt(strs[1]);
            w = Integer.parseInt(strs[2]);
            x = Integer.parseInt(strs[3]);
            c = Integer.parseInt(strs[4]);
        } catch (Exception e) {
            // TODO: handle exception
        }
    }

    void solve() {
        int res = 0;
//      int cnt = 0;
        while (c > a) {
//          if (cnt++ > 10) break;
//          System.out.println("a:" + a + " b:" + b + " w:" + w + " x:" + x + " c:" + c );
            if (b >= x) {
                b -= x;
                c--;
                res++;
                /*
                int subtract = b - x;
                int num = subtract / x + 1;
                if (c - num <= a) {
                    for (int i = 0; i < num; i++) {
                        c -= 1;
                        res++;

                        if (c <= a) break;
                    }
                } else {
                    res += num;
                    c -= num;
                    b = b - x * num;
                }
                */
            } else {
                int subtract = w - x;
                int num = (x - b) / subtract;
                if (num == 0) num++;

                a -= num;
                c -= num;
                b += num * subtract;
                res += num;
            }
        }

        System.out.println(res);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class NumberBusters {

    int a, b, w, x, c;

    public static void main(String[] args) {
        NumberBusters nb = new NumberBusters();
        nb.read();
        nb.solve();
    }

    void read() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
            String[] strs = br.readLine().split(" ");
            a = Integer.parseInt(strs[0]);
            b = Integer.parseInt(strs[1]);
            w = Integer.parseInt(strs[2]);
            x = Integer.parseInt(strs[3]);
            c = Integer.parseInt(strs[4]);
        } catch (Exception e) {
            // TODO: handle exception
        }
    }

    void solve() {
        int res = 0;
//      int cnt = 0;
        while (c > a) {
//          if (cnt++ > 10) break;
//          System.out.println("a:" + a + " b:" + b + " w:" + w + " x:" + x + " c:" + c );
            if (b >= x) {
                b -= x;
                c--;
                res++;
                /*
                int subtract = b - x;
                int num = subtract / x + 1;
                if (c - num <= a) {
                    for (int i = 0; i < num; i++) {
                        c -= 1;
                        res++;

                        if (c <= a) break;
                    }
                } else {
                    res += num;
                    c -= num;
                    b = b - x * num;
                }
                */
            } else {
                int subtract = w - x;
                int num = (x - b) / subtract;
                int sub2 = (x - b) - subtract * num;
                if (sub2 != 0) num++;

                a -= num;
                c -= num;
                b += num * subtract;
                res += num;
            }
        }

        System.out.println(res);
    }
}

import java.util.*;

import java.io.*;
public class Test {

	public static void main(String[] args) throws Exception{
		  Scanner aa = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
	      long a,b,x,w,c;
	      a=aa.nextLong();
	      b=aa.nextLong();
	      w=aa.nextLong();
	      x=aa.nextLong();
	      c=aa.nextLong();
	      long count=0;
	      if(b/x<c-a)
	      count = ((c-a)*x-b)/(w-x);

	      count+=c-a;
	      System.out.println(count);
	}
}

import java.text.DateFormat;
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;

import static java.lang.Math.*;

public class solver {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    String readString() throws IOException{
        while (tok==null || !tok.hasMoreTokens()){
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return null;
            }

        }
        return tok.nextToken();
    }
    int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(readString());
    }
    long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(readString());
    }
    double readDouble() throws NumberFormatException, IOException{
        return Double.parseDouble(readString());
    }

    final static boolean OJ=System.getProperty("ONLINE_JUDGE")!=null;

    void init() throws FileNotFoundException{
        if (OJ){
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);
        }else{
            in=new BufferedReader(new FileReader("input.txt"));
            out=new PrintWriter("output.txt");
        }
    }
    int[] iMas(int n) throws NumberFormatException, IOException{
        int[] a=new int[n];
        for (int i=0;i<n;i++){
            a[i]=readInt();
        }
        return a;
    }

    int gcd(int a,int b){
        return (b==0)?a:gcd(b,a%b);
    }

    void solve() throws IOException{
        int a=readInt();
        int b=readInt();
        int w=readInt();
        int x=readInt();
        int c=readInt();
        int[] z=new int[2000];
        int[] k=new int[2000];
        Arrays.fill(z, -1);
        z[b]=0;
        int bb=b;
        int index=0;

        int kolx=0;
        int koly=0;

        while (true){
            int old=bb;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                p=true;
                bb+=w;
            }
            boolean pp=false;
            if (z[bb]!=-1){
                kolx=k[old]+1-k[bb];
                koly=z[old]+((p)?1:0)-z[bb];

                index=bb;
                break;
            }
            if (z[bb]==-1){
                z[bb]=0;
            }
            k[bb]=k[old]+1;
            if (p) z[bb]=z[old]+1;else z[bb]=z[old];

        }
        long answer=0;
        bb=b;
        while (bb!=index){
            if (c<=a){
                out.println(answer);
                return;
            }
            answer++;
            c--;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                bb+=w;
                a--;
            }
        }
        int l=0;
        int r=2*(int)1e9;
        int ans=0;
        while (l<=r){
            int mid=l+(r-l)/2;
            if (c-(long)mid*kolx>=a-(long)mid*koly){
                ans=mid;
                l=mid+1;
            }else{
                r=mid-1;
            }
        }
        ans--;
        if (ans!=-1){
            c-=ans*kolx;
            a-=ans*koly;
            answer+=ans*kolx;
        }

//      while (true){
//          if (kolx==0 && koly==0) break;
//          if (c-kolx<=a-koly) break;
//          c-=kolx;
//          answer+=kolx;
//          a-=koly;
//      }

        bb=index;
        while (true){
            if (c<=a){
                out.println(answer);
                return;
            }
            answer++;
            c--;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                bb+=w;
                a--;
            }
        }

    }

    void run() throws NumberFormatException, IOException{
        init();
        long h=System.currentTimeMillis();
        solve();
        System.err.println(System.currentTimeMillis()-h);
        out.close();
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        new solver().run();
    }

}

import java.text.DateFormat;
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;

import static java.lang.Math.*;

public class solver {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    String readString() throws IOException{
        while (tok==null || !tok.hasMoreTokens()){
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return null;
            }

        }
        return tok.nextToken();
    }
    int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(readString());
    }
    long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(readString());
    }
    double readDouble() throws NumberFormatException, IOException{
        return Double.parseDouble(readString());
    }

    final static boolean OJ=System.getProperty("ONLINE_JUDGE")!=null;

    void init() throws FileNotFoundException{
        if (OJ){
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);
        }else{
            in=new BufferedReader(new FileReader("input.txt"));
            out=new PrintWriter("output.txt");
        }
    }
    int[] iMas(int n) throws NumberFormatException, IOException{
        int[] a=new int[n];
        for (int i=0;i<n;i++){
            a[i]=readInt();
        }
        return a;
    }

    int gcd(int a,int b){
        return (b==0)?a:gcd(b,a%b);
    }

    void solve() throws IOException{
        int a=readInt();
        int b=readInt();
        int w=readInt();
        int x=readInt();
        int c=readInt();
        int[] z=new int[2000];
        int[] k=new int[2000];
        Arrays.fill(z, -1);
        z[b]=0;
        int bb=b;
        int index=0;

        int kolx=0;
        int koly=0;

        while (true){
            int old=bb;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                p=true;
                bb+=w;
            }
            boolean pp=false;
            if (z[bb]!=-1){
                kolx=k[old]+1-k[bb];
                koly=z[old]+((p)?1:0)-z[bb];

                index=bb;
                break;
            }
            if (z[bb]==-1){
                z[bb]=0;
            }
            k[bb]=k[old]+1;
            if (p) z[bb]=z[old]+1;else z[bb]=z[old];

        }
        long answer=0;
        bb=b;
        while (bb!=index){
            if (c<=a){
                out.println(answer);
                return;
            }
            answer++;
            c--;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                bb+=w;
                a--;
            }
        }
        int l=0;
        int r=2*(int)1e9;
        int ans=0;
        while (l<=r){
            int mid=l+(r-l)/2;
            if (c-(long)mid*kolx<=a-(long)mid*koly){
                ans=mid;
                r=mid-1;
            }else{
                l=mid+1;
            }
        }
        ans--;
        if (ans!=-1){
            c-=ans*kolx;
            a-=ans*koly;
            answer+=ans*kolx;
        }

//      while (true){
//          if (kolx==0 && koly==0) break;
//          if (c-kolx<=a-koly) break;
//          c-=kolx;
//          answer+=kolx;
//          a-=koly;
//      }

        bb=index;
        while (true){
            if (c<=a){
                out.println(answer);
                return;
            }
            answer++;
            c--;
            bb-=x;
            boolean p=false;
            if (bb<0) {
                bb+=w;
                a--;
            }
        }

    }

    void run() throws NumberFormatException, IOException{
        init();
        long h=System.currentTimeMillis();
        solve();
        System.err.println(System.currentTimeMillis()-h);
        out.close();
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        new solver().run();
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vadim Semenov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextLong();
        long b = in.nextLong();
        long w = in.nextLong();
        long x = in.nextLong();
        long c = in.nextLong();
        long left = -1;
        long right = 10L * Integer.MAX_VALUE;
        while (right - left > 1) {
            long mid = (right + left) >> 1;
            long k = mid - c + a;
            if (w * k + b - mid * x >= 0) {
                right = mid;
            } else {
                left = mid;
            }
        }
        out.println(right);
    }
}

class InputReader {
    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String next() {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    }

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vadim Semenov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextLong();
        long b = in.nextLong();
        long w = in.nextLong();
        long x = in.nextLong();
        long c = in.nextLong();
        long left = -1;
        long right = 100L * Integer.MAX_VALUE;
        while (right - left > 1) {
            long mid = (right + left) >> 1;
            if (mid * (w - x) + b - w * (c - a) >= 0) {
                System.err.println(mid * (w - x) + b - w * (c - a));
                right = mid;
            } else {
                left = mid;
            }
        }
         out.println(right);
    }
}

class InputReader {
    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String next() {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int a = ni();
		int b = ni();
		int w = ni();
		int x = ni();
		int c = ni();

		int step = 1500;

		int[] move_b = new int[w];
		for (int i = 0; i < w; i++)
			move_b[i] = i;
		int[] next_move = new int[w];

		int[] dif_b = new int[w];
		int[] next_dif = new int[w];

		for (int move = 1; move <= step; move++) {
			for (int bb = 0; bb < w; bb++) {
				int prev_b = move_b[bb];
				int prev_dif = dif_b[bb];

				if (prev_b >= x) {
					next_move[bb] = prev_b - x;
					next_dif[bb] = prev_dif;
				} else {
					next_move[bb] = w - (x - prev_b);
					next_dif[bb] = prev_dif + 1;
				}

			}
			int[] t = dif_b;
			dif_b = next_dif;
			next_dif = t;
			Arrays.fill(next_dif, 0);

			int[] t2 = move_b;
			move_b = next_move;
			next_move = t2;
			Arrays.fill(next_move, 0);

		}
		int t = 0;
		while (true) {
			int next_c = c -step;
			int next_a = a - dif_b[b];
			if(next_c <= next_a)
				break;

			a -= dif_b[b];
			b = move_b[b];
			t += step;
			c -= step;

		}
		while (c > a) {
			c--;
			if (b < x)
				a--;
			if (b >= x) {
				b = b - x;
			} else {
				b = w - (x - b);
			}
			t++;
		}

		return t;
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class NumberBusters2 {
    void solve() {
        int a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();

        if (c <= a) {
            out.println(0);
            return;
        }

        int k = ((c - a) * x - b + w - x - 1) / (w - x);
        out.println(c - a + k);
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NumberBusters2().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Alex
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out){
	    long a = in.readLong(), b = in.readLong(), w = in.readLong(), x = in.readLong(), c = in.readLong();
	    w -= x;
	    long min = 0, max = (long) 1e18;
	    while(min < max){
		    long avg = (min + max) / 2;
		    if (works(avg, a, b, c, w, x)) max = avg;
		    else min = avg + 1;
	    }
	    out.printLine(min);
}
	boolean works(long val, long a, long b, long c, long w, long x){
		long cres = c - val;
		long amin = cres;
		long maxasubtract = a - amin;
		if(maxasubtract < 0) return false;
		long bsubtract = val - maxasubtract;
		long bres = b + maxasubtract * w - x * bsubtract;
		return bres >= 0;
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public void close() {
		writer.close();
	}
	public void printLine(long i) {
		writer.println(i);
	}
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Alex
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out){
	    long a = in.readLong(), b = in.readLong(), w = in.readLong(), x = in.readLong(), c = in.readLong();
	    w -= x;
	    long min = 0, max = (long) 1e10;
	    while(min < max){
		    long avg = (min + max) / 2;
		    if (works(avg, a, b, c, w, x)) max = avg;
		    else min = avg + 1;
	    }
	    out.printLine(min);
}
	boolean works(long val, long a, long b, long c, long w, long x){
		long cres = c - val;
		long amin = cres;
		long maxasubtract = a - amin;
		if(maxasubtract < 0) return false;
		long bsubtract = val - maxasubtract;
		long bres = b + maxasubtract * w - x * bsubtract;
		return bres >= 0;
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public void close() {
		writer.close();
	}
	public void printLine(long i) {
		writer.println(i);
	}
}

import javafx.util.Pair;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        ConsoleIO io = new ConsoleIO();
        new Main(io).solve();
        io.flush();
    }
    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }

    public void solve() {
        io.writeLine(""+get());
    }
    long get(){
        int[] l = io.readIntArray();
        int a = l[0],b=l[1],w=l[2],x=l[3],c=l[4];
        int res = 0;
        int[] ff =  new int[10000];
        int[] dd = new int[10000];
        int[] rr = new int[10000];
        int i = 0;
        int dif = c-a;
        while(dif>0 && i<ff.length){
            dif--;
            b-=x;
            res++;
            if(b<0){
                b+=w;
                dif++;
            }
            else
                ff[i] = 1;
            dd[i] = dif;
            rr[i] = res;
            i++;
        }
        if(dif<=0)return res;
        for(int j = dd.length-2;j>=0;j--){
            if(ff[j] == 0 && ff[j+1]==1){
                int k = j-1;
                int ones = 0;
                for(;k>=0;k--)if(ff[k] == 0 && ff[k+1]==1)break;else if(ff[k]==1)ones++;
                return (long)(dd[j]/ones-1)*(j-k) + dd[j]%ones + rr[j]+1;
            }
        }
        return -1000;
    }

}

class ConsoleIO {
    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}
    public void flush(){
        this.out.close();
    }
    public void writeLine(String s) {
        this.out.println(s);
    }
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long readLong() {
        return Long.parseLong(this.readLine());
    }
    public int readInt() {
        return Integer.parseInt(this.readLine());
    }
    public int[] readIntArray() {
        String[]n=this.readLine().split(" ");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
}

import javafx.util.Pair;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        ConsoleIO io = new ConsoleIO();
        new Main(io).solve();
        io.flush();
    }
    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }

    public void solve() {
        io.writeLine(""+get());
    }
    int get(){
        int[] l = io.readIntArray();
        int a = l[0],b=l[1],w=l[2],x=l[3],c=l[4];
        int res = 0;
        int[] ff =  new int[10000];
        int[] dd = new int[10000];
        int[] rr = new int[10000];
        int i = 0;
        int dif = c-a;
        while(dif>0 && i<ff.length){
            dif--;
            b-=x;
            res++;
            if(b<0){
                b+=w;
                dif++;
            }
            else
                ff[i] = 1;
            dd[i] = dif;
            rr[i] = res;
            i++;
        }
        if(dif<=0)return res;
        for(int j = dd.length-1;j>=0;j--){
            if(ff[j] == 1){
                int k = j-1;
                for(;k>=0;k--)if(ff[k] == 1)break;
                return dd[j]/(j-k)*(j-k+1) + rr[j];
            }
        }
        return -1000;
    }

}

class ConsoleIO {
    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}
    public void flush(){
        this.out.close();
    }
    public void writeLine(String s) {
        this.out.println(s);
    }
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long readLong() {
        return Long.parseLong(this.readLine());
    }
    public int readInt() {
        return Integer.parseInt(this.readLine());
    }
    public int[] readIntArray() {
        String[]n=this.readLine().split(" ");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 * @author pttrung
 */
public class B_Round_224_Div2 {

    public static long MOD = 1000000007;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        int a= in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();
        if(c <= a){
        	out.println(0);
        }else{

        	int dif = c - a;
        	int []step = new int[w + 1];
        	int[] d = new int[w + 1];
        	Arrays.fill(step, -1);
        	step[b] = 0;
        	d[b] = dif;
        	int cur = 0;
        	while(true){
        		//System.out.println(b);
        		if(b >= x){
        			int num = b/x;
        			if(dif > num){
        				dif -= num;
        				cur += num;
        				b = b % x;

        			}else{
        				cur += dif;
        				break;
        			}
        		}else {
        			b = w - (x - b);

        			cur++;
        		}
        		if(step[b] != -1){

					int n = d[b] - dif;
					int l = cur - step[b];
					int v = dif / n;
					if(v > 1){
						v--;
						cur += l*v;
						dif = n + dif % n;
					}

				}else{
					step[b] = cur;
					d[b] = dif;

				}
        	}
        	out.println(cur);
        }

        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _382B solver = new _382B();
        solver.solve(1, in, out);
        out.close();
    }

    static class _382B {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int w = in.nextInt();
            int x = in.nextInt();

            int c = in.nextInt();

            if (c <= a) {
                out.println(0);
                return;
            }

            int[] step = new int[w];
            int[] ad = new int[w];

            Arrays.fill(step, -1);
            step[b] = 0;

            int cp = -1;
            int cl = -1;
            int fad = -1;
            int t = 1;
            while (true) {
                if (b >= x) {
                    b = b - x;
                    if (step[b] != -1) {
                        cp = b;
                        cl = t - step[b];
                        fad = ad[b + x] - ad[b];
                        break;
                    } else {
                        step[b] = t;
                        ad[b] = ad[b + x];
                    }
                } else {
                    int nb = w - (x - b);

                    if (step[nb] != -1) {
                        cp = nb;
                        cl = t - step[nb];
                        fad = ad[nb] + 1 - ad[b];
                        break;
                    } else {
                        step[nb] = t;
                        ad[nb] = ad[b] + 1;
                    }

                    b = nb;
                }
                t++;
            }

            long ct = 0;
            if (cp != b) {
                if (c - step[cp] <= a) {
                    out.println(simul(a, b, w, x, c));
                    return;
                }
                a -= ad[cp];
                ct += step[cp];
                c -= step[cp];
                b = cp;
            }

            if (a + cl + 1 >= c) {
                out.println(ct + simul(a, b, w, x, c));
                return;
            }

            long tot = (c - (a + cl + 1)) / (cl - fad);

            ct += tot * cl;
            a -= tot * fad;
            c -= tot * cl;

            out.println(ct + simul(a, b, w, x, c));
        }

        int simul(int a, int b, int w, int x, int c) {
            int ct = 0;
            while (c > a) {
                if (b >= x) {
                    b = b - x;
                } else {
                    b = w - (x - b);
                    a = a - 1;
                }
                ct++;
                c--;
            }

            return ct;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _382B solver = new _382B();
        solver.solve(1, in, out);
        out.close();
    }

    static class _382B {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int w = in.nextInt();
            int x = in.nextInt();

            int c = in.nextInt();

            if (c <= a) {
                out.println(0);
                return;
            }

            int[] step = new int[w];
            int[] ad = new int[w];

            Arrays.fill(step, -1);
            step[b] = 0;

            int cp = -1;
            int cl = -1;
            int fad = -1;
            int t = 1;
            while (true) {
                if (b >= x) {
                    b = b - x;
                    if (step[b] != -1) {
                        cp = b;
                        cl = t - step[b];
                        fad = ad[b + x] - ad[b];
                        break;
                    } else {
                        step[b] = t;
                        ad[b] = ad[b + x];
                    }
                } else {
                    int nb = w - (x - b);

                    if (step[nb] != -1) {
                        cp = nb;
                        cl = t - step[nb];
                        fad = ad[nb] + 1 - ad[b];
                        break;
                    } else {
                        step[nb] = t;
                        ad[nb] = ad[b] + 1;
                    }

                    b = nb;
                }
                t++;
            }

            long ct = 0;
            if (cp != b) {
                if (c - step[cp] <= a - ad[cp]) {
                    out.println(simul(a, b, w, x, c));
                    return;
                }
                a -= ad[cp];
                ct += step[cp];
                c -= step[cp];
                b = cp;
            }

            if (a + cl + 1 >= c) {
                out.println(ct + simul(a, b, w, x, c));
                return;
            }

            long tot = (c - (a + cl + 1)) / (cl - fad);

            ct += tot * cl;
            a -= tot * fad;
            c -= tot * cl;

            out.println(ct + simul(a, b, w, x, c));
        }

        int simul(int a, int b, int w, int x, int c) {
            int ct = 0;
            while (c > a) {
                if (b >= x) {
                    b = b - x;
                } else {
                    b = w - (x - b);
                    a = a - 1;
                }
                ct++;
                c--;
            }

            return ct;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    public void solve(Scanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();

        long time = 0;
        int d = c - a;
        int offset = b / x;
        if (d <= offset) {
            System.out.println(Math.max(0, d));
            return;
        }
        d -= offset;
        time = offset + 1;
        long curr = w - (x - b % x);
//        System.out.println(curr);
        long cycle = 0L;
        for (int i = 0; i < x; i++) {
            cycle += curr / x;
            curr = w - (x - curr % x);
//            System.out.println(curr);
        }
//        System.out.println(cycle);

        time += Math.max(d / cycle - 1, 0) * (cycle + x);
        d -= Math.max(d / cycle - 1, 0);
        while (d > 0) {
            if (curr >= x) {
                curr = curr - x;
                --d;
            } else {
                curr = w - (x - curr);
            }
            ++time;
        }
        System.out.println(time);
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;
        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    public void solve(Scanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();

        int time = 0;
        int d = c - a;
        int offset = b / x;
        if (d <= offset) {
            System.out.println(Math.max(0, d));
            return;
        }
        d -= offset;
        time = offset + 1;
        int curr = w - (x - b % x);
//        System.out.println(curr);
        int cycle = 0;
        for (int i = 0; i < x; i++) {
            cycle += curr / x;
            curr = w - (x - curr % x);
//            System.out.println(curr);
        }
//        System.out.println(cycle);

        time += Math.max(d / cycle - 1, 0) * (cycle + x);
        d -= Math.max(d / cycle - 1, 0);
        while (d > 0) {
            if (curr >= x) {
                curr = curr - x;
                --d;
            } else {
                curr = w - (x - curr);
            }
            ++time;
        }
        System.out.println(time);
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;
        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    public void solve(Scanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();

        int time = 0;
        int d = c - a;
        int offset = b / x;
        if (d <= offset) {
            System.out.println(Math.max(0, d));
            return;
        }
        d -= offset;
        time = offset + 1;
        int curr = w - (x - b % x);
//        System.out.println(curr);
        int cycle = 0;
        for (int i = 0; i < x; i++) {
            cycle += curr / x;
            curr = w - (x - curr % x);
//            System.out.println(curr);
        }
//        System.out.println(cycle);

        time += (d / cycle - 1) * (cycle + x);
        d -= d / cycle - 1;
        while (d > 0) {
            if (curr >= x) {
                curr = curr - x;
                --d;
            } else {
                curr = w - (x - curr);
            }
            ++time;
        }
        System.out.println(time);
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;
        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}

import java.util.Scanner;
public class Works {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int w = in.nextInt();
        int x = in.nextInt();
        int c = in.nextInt();
        if (b >= 0 && b < w && x > 0 && x < w)
            if (c <= a) System.out.println(0);
            else  {
                long sec = (long)Math.ceil(1.0*((c - a) * x - b) / (w - x));
                System.out.println(sec + c - a);
    }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int a=in.nextInt();
		int b=in.nextInt();
		int w=in.nextInt();
		int x=in.nextInt();
		int c=in.nextInt();

		if(c<=a){
			out.println(0);
			return;
		}

		int[] mod=new int[w+10];
		int[] d=new int[w+10];
		int[] loopIndex=new int[w+10];
		Arrays.fill(mod, -1);
//		mod[b]=0;
		int loop=0;
		int loopTotal=0;
		int index=1;
		int lastLoop=0;
		for(int i=1;;i++){
			if(b>=x){
				b-=x;
				d[b]=0;
				if(mod[b]!=-1){
					break;
				}else{
					mod[b]=i;
					lastLoop=i;
				}
			}else{
				b=w+b-x;
				d[b]=1;
				loopIndex[index++]=i;
				if(mod[b]!=-1){
					if(d[b]==0){

					}
					break;
				}else{
					mod[b]=i;
					if(d[b]==1){
						loopTotal++;
					}
				}
			}
			loop++;
		}

		int t=(c-a)/(loop-loopTotal);
		int s=(c-a)%(loop-loopTotal);

		int ss=0;
		int sss=s;
		while(sss>0){
			ss++;
			if(d[s]==1){
				continue;
			}else{
				sss--;
			}
		}

		int ans=0;
		if(s==0){
			ans=(t-1)*loop+lastLoop;
		}else{
			ans=t*loop+ss;
		}
		out.println(ans);
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int a=in.nextInt();
		int b=in.nextInt();
		int w=in.nextInt();
		int x=in.nextInt();
		int c=in.nextInt();

		if(c<=a){
			out.println(0);
			return;
		}

		Result[] r=new Result[w+10];
		int[] mod=new int[w+10];
		Arrays.fill(mod, -1);
		r[0]=new Result(b, 0, 0);
		int loop_start=0;
		int index=1;
		for(index=1;;index++){
			Result re;
			if(b>=x){
				b-=x;
				re=new Result(b, index, r[index-1].total+1);
			}else{
				b=w+b-x;
				re=new Result(b, index, r[index-1].total);
			}
			if(mod[b]!=-1){
				loop_start=mod[b];
				break;
			}else{
				mod[b]=index;
				r[index]=re;
			}
		}

		int loop_cnt=index-loop_start;
		int total=r[index-1].total-r[loop_start-1].total;
		int total_start=r[loop_start].total;
		int ans=0;
		if(c-a<=r[loop_start-1].total){
			int tmp=loop_start-1;
			while(r[tmp].total>=(c-a)){
				tmp--;
			}
			ans=tmp++;
			out.println(ans);
			return;
		}
		c-=r[loop_start-1].total;
		ans+=loop_start-1;
		int t=(c-a)/total;
		int s=(c-a)%total;

		if(s==0){
			ans+=(t-1)*loop_cnt;
			int tmp=index-1;
			while(r[tmp].total==r[index-1].total){
				tmp--;
			}
			ans+=tmp+1;
		}else{
			ans+=t*loop_cnt;
			int tmp=loop_start;
			while(r[tmp].total-r[loop_start-1].total<s){
				tmp++;
			}
			ans+=tmp-loop_start+1;
		}

		out.println(ans);
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class B {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int MAX = 1000;
	public void solve() throws IOException {
		int A = nextInt();
		int B = nextInt();
		int W = nextInt();
		int X = nextInt();
		int C = nextInt();
		int OC = C;

		int[] rounds = new int[MAX+1];
		int[] nexts = new int[MAX+1];

		for (int b = 0; b <= MAX; b++) {
			if (b < X) {
				rounds[b] = 1;
			} else {
				rounds[b] = (b-X)/X + 1 + 1;
			}
			nexts[b] = W - (X - (b - (rounds[b]-1) * X));
//			System.out.println(b + ": " + rounds[b] + ": " + nexts[b]);
		}

		boolean jumped = false;
		int[][] reached = new int[MAX+1][];
		reached[B] = new int[] {C, A};

		while (C - rounds[B] > A - 1) {
			C -= rounds[B];
			A -= 1;

			if (jumped || reached[nexts[B]] == null) {
				reached[nexts[B]] = new int[] {C, A};
			} else {
				int gapC = reached[nexts[B]][0] - C;
				int gapA = reached[nexts[B]][1] - A;

				int jump = (C-1-A) / (gapC - gapA);
				if (C - jump * gapC > A - jump * gapA) {
					C -= jump * gapC;
					A -= jump * gapA;
				}
				jumped = true;
			}
			B = nexts[B];
		}

		while (C > A) {
			B -= X;
			C--;
		}

		out.println(OC - C);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new B().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class B {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int MAX = 1000;
	public void solve() throws IOException {
		int A = nextInt();
		int B = nextInt();
		int W = nextInt();
		int X = nextInt();
		int C = nextInt();
		int OC = C;

		int[] rounds = new int[MAX+1];
		int[] nexts = new int[MAX+1];

		for (int b = 0; b <= MAX; b++) {
			if (b < X) {
				rounds[b] = 1;
			} else {
				rounds[b] = (b-X)/X + 1 + 1;
			}
			nexts[b] = W - (X - (b - (rounds[b]-1) * X));
//			System.out.println(b + ": " + rounds[b] + ": " + nexts[b]);
		}

		boolean jumped = false;
		int[][] reached = new int[MAX+1][];
		reached[B] = new int[] {C, A};

		while (C - rounds[B] > A - 1) {
			C -= rounds[B];
			A -= 1;

			if (jumped || reached[nexts[B]] == null) {
				reached[nexts[B]] = new int[] {C, A};
			} else {
				int gapC = reached[nexts[B]][0] - C;
				int gapA = reached[nexts[B]][1] - A;

				int jump = (C-A) / (gapC - gapA) - 1;
				if (jump > 0) {
					if (C - jump * gapC > A - jump * gapA) {
						C -= jump * gapC;
						A -= jump * gapA;
					}
				}
				jumped = true;
			}
			B = nexts[B];
		}

		while (C > A) {
			B -= X;
			C--;
		}

		out.println(OC - C);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new B().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) throws IOException {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long a = scan.nextInt(), b = scan.nextInt(), w = scan.nextInt(), x = scan.nextInt(), c = scan.nextInt();
		b = w-b-1;
		long best = 0, l = 0, r = (long)1e10;
		while(l < r){
			long mid = (l+r)/2;
			long cura = a-(b+mid*x)/w;
			long curc = c-mid;
			if(curc <= cura){
				best = mid;
				r = mid;
			}
			else l = mid+1;
		}
		out.println(best);
		out.close();
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}

		public int[] nextArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}

}

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int a = sc.nextInt(), b = sc.nextInt(), w = sc.nextInt();
		int x = sc.nextInt(), c = sc.nextInt();

		ArrayList<Integer> ch = new ArrayList<>();
		boolean[] vis = new boolean[w + 1];
		int crossCount = 0;
		while(!vis[b])
		{
			ch.add(b);
			vis[b] = true;
			b -= x;
			if(b < 0) { ++crossCount; b += w; }
		}

		long ans = -1, lo = 0, hi = (long)1e12;
		while(lo <= hi)
		{
			long t = (lo + hi) / 2;
			long A = t / ch.size() * crossCount;
			long end = t % ch.size();
			for(int i = 0; i < end; ++i)
				if(ch.get(i) < x)
					++A;
			if(c - t <= a - A)
			{
				ans = t;
				hi = t - 1;
			}
			else
				lo = t + 1;
		}
		out.println(ans);
		out.close();
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader s) throws FileNotFoundException {	br = new BufferedReader(s);}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {

    public static Scanner cin = new Scanner(System.in);

    public static final int N = 150000;

    public static void main(String[] args) throws IOException  {
        //BufferedReader in = new BufferedReader(new FileReader(new File("D:/java.inp")));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String s = in.readLine();
        String[] st = s.split(" ");
        int a = Integer.parseInt(st[0]);
        int b = Integer.parseInt(st[1]);
        int w = Integer.parseInt(st[2]);
        int x = Integer.parseInt(st[3]);
        int c = Integer.parseInt(st[4]);

        b = w-b-1;
        int l = 0, r = 2000000000, res = 0;
        while (l <= r) {
            int mid = (l+r)/2;
            int aa = a-(b+mid*x)/w;
            int cc = c-mid;
            if (cc <= aa) {
                res = mid;
                r = mid-1;
            }
            else
                l = mid+1;
        }

        System.out.print(res);
    }

}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {

    public static Scanner cin = new Scanner(System.in);

    public static final int N = 150000;

    public static void main(String[] args) throws IOException  {
        //BufferedReader in = new BufferedReader(new FileReader(new File("D:/java.inp")));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String s = in.readLine();
        String[] st = s.split(" ");
        int a = Integer.parseInt(st[0]);
        int b = Integer.parseInt(st[1]);
        int w = Integer.parseInt(st[2]);
        int x = Integer.parseInt(st[3]);
        int c = Integer.parseInt(st[4]);

        b = w-b-1;
        int l = 1, r = 2000000000, res = 0;
        while (l <= r) {
            int mid = (l+r)/2;
            int aa = a-(b+mid*x)/w;
            int cc = c-mid;
            if (cc <= aa) {
                res = mid;
                r = mid-1;
            }
            else
                l = mid+1;
        }

        System.out.print(res);
    }

}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {

    public static Scanner cin = new Scanner(System.in);

    public static final int N = 150000;

    public static void main(String[] args) throws IOException  {
        //BufferedReader in = new BufferedReader(new FileReader(new File("D:/java.inp")));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String s = in.readLine();
        String[] st = s.split(" ");
        long a = Long.parseLong(st[0]);
        long b = Long.parseLong(st[1]);
        long w = Long.parseLong(st[2]);
        long x = Long.parseLong(st[3]);
        long c = Long.parseLong(st[4]);

        b = w-b-1;
        long l = 0, r = (long)1000000000000l, res = 0;
        while (l <= r) {
            long mid = (l+r)/2;
            long aa = a-(b+mid*x)/w;
            long cc = c-mid;
            if (cc <= aa) {
                res = mid;
                r = mid-1;
            }
            else
                l = mid+1;
        }

        System.out.print(res);
    }

}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {

    public static Scanner cin = new Scanner(System.in);

    public static final int N = 150000;

    public static void main(String[] args) throws IOException  {
        //BufferedReader in = new BufferedReader(new FileReader(new File("D:/java.inp")));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String s = in.readLine();
        String[] st = s.split(" ");
        long a = Long.parseLong(st[0]);
        long b = Long.parseLong(st[1]);
        long w = Long.parseLong(st[2]);
        long x = Long.parseLong(st[3]);
        long c = Long.parseLong(st[4]);

        b = w-b-1;
        long l = 0, r = (long) 2000000000, res = 0;
        while (l <= r) {
            long mid = (l+r)/2;
            long aa = a-(b+mid*x)/w;
            long cc = c-mid;
            if (cc <= aa) {
                res = mid;
                r = mid-1;
            }
            else
                l = mid+1;
        }

        System.out.print(res);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class NumberBusters {
    void solve() {
        int a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();

        if (c <= a) {
            out.println(0);
            return;
        }

        int delta = c - a;
        int[] cnt = getCount(b, w, x);

        if (b >= x) {
            if (cnt[0] >= delta) {
                out.println(delta);
                return;
            }
            long ans = cnt[0];
            delta -= cnt[0];
            int n = (delta + cnt[2] - 1) / cnt[2], q = delta / cnt[2], r = delta % cnt[2];
            ans += (long) cnt[1] * n;
            ans += (long) cnt[2] * q;
            ans += r;
            out.println(ans);
        } else {
            long ans = cnt[0];
            int q = delta / cnt[1], r = delta % cnt[1];
            ans += (long) cnt[1] * q;
            if (r > 0) ans += (long) cnt[2] * q;
            else ans += (long) cnt[2] * (q - 1);
            ans += r;
            out.println(ans);
        }
    }

    int[] getCount(int b, int w, int x) {
        int[] cnt = new int[3];
        if (b >= x) {
            while (b >= x) {
                b -= x;
                cnt[0]++;
            }
            while (b < x) {
                b += w - x;
                cnt[1]++;
            }
            while (b >= x) {
                b -= x;
                cnt[2]++;
            }
        } else {
            while (b < x) {
                b += w - x;
                cnt[0]++;
            }
            while (b >= x) {
                b -= x;
                cnt[1]++;
            }
            while (b < x) {
                b += w - x;
                cnt[2]++;
            }
        }
        return cnt;
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NumberBusters().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class NumberBusters {
    void solve() {
        int a = in.nextInt(), b = in.nextInt(), w = in.nextInt(), x = in.nextInt(), c = in.nextInt();

        if (c <= a) {
            out.println(0);
            return;
        }

        int delta = c - a;
        int[] cnt = getCount(b, w, x);

        if (cnt[0] >= delta) {
            out.println(delta);
            return;
        }

        long ans = cnt[0];
        delta -= cnt[0];

        int n = (delta + cnt[2] - 1) / cnt[2], q = delta / cnt[2], r = delta % cnt[2];
        ans += (long) cnt[1] * n;
        ans += (long) cnt[2] * q;
        ans += r;

        out.println(ans);
    }

    int[] getCount(int b, int w, int x) {
        int[] cnt = new int[3];
        while (b >= x) {
            b -= x;
            cnt[0]++;
        }
        while (b < x) {
            b += w - x;
            cnt[1]++;
        }
        while (b >= x) {
            b -= x;
            cnt[2]++;
        }
        return cnt;
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NumberBusters().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.EmptyStackException;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int a = ni();
		int b = ni();
		int w = ni();
		int x = ni();
		int c = ni();

		int step = 1500;

		int[] move_b = new int[w];
		for (int i = 0; i < w; i++)
			move_b[i] = i;
		int[] next_move = new int[w];

		int[] dif_b = new int[w];
		int[] next_dif = new int[w];

		for (int move = 1; move <= step; move++) {
			for (int bb = 0; bb < w; bb++) {
				int prev_b = move_b[bb];
				int prev_dif = dif_b[bb];

				if (prev_b >= x) {
					next_move[bb] = prev_b - x;
					next_dif[bb] = prev_dif;
				} else {
					next_move[bb] = w - (x - prev_b);
					next_dif[bb] = prev_dif + 1;
				}

			}
			int[] t = dif_b;
			dif_b = next_dif;
			next_dif = t;
			Arrays.fill(next_dif, 0);

			int[] t2 = move_b;
			move_b = next_move;
			next_move = t2;
			Arrays.fill(next_move, 0);

		}
		int t = 0;
		while (true) {
			int next_c = c -step;
			int next_a = a - dif_b[b];
			if(next_c <= next_a)
				break;

			a -= dif_b[b];
			b = move_b[b];
			t += step;
			c -= step;

		}
		while (c > a) {
			c--;
			if (b < x)
				a--;
			if (b >= x) {
				b = b - x;
			} else {
				b = w - (x - b);
			}
			t++;
		}

		return t;
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
}

import java.util.*;
import java.io.*;

public class Busters {
    public static void main(String[] args) throws IOException {
        BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(rd.readLine());
        a = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        w = Integer.parseInt(st.nextToken());
        x = Integer.parseInt(st.nextToken());
        c = Integer.parseInt(st.nextToken());
        countPeriods();
        System.out.println(bin(0, Integer.MAX_VALUE));
    }

    static long bin(long a, long b){
        if(a==b) return a;
        if(b==a+1) return check(a) ? a : b;
        long m = (a+b)/2;
        return check(m) ? bin(a, m) : bin(m+1, b);
    }

    static boolean check(long X){
        long A = a - count(X), C = c-X;
        return C <= A;
    }

    static long count(long X){
        if(X<=P) return simulation((int)X);
        long res = 1L*S*(X/P);
        return res + count(X % P);
    }

    static int simulation(int X){
        int num = 0;
        int B = b;
        for(int i=0; i<X; i++){
            if(B>=x){
                B -= x;
            }
            else{
                B -= x;
                B += w;
                num++;
            }
        }
        return num;
    }

    static void countPeriods(){
        int curB = b;
        boolean first = true;
        while(true){
            if(curB==b && !first) break;
            first = false;
            if(curB >= x){
                curB -= x;
                P++;
            }
            else{
                P++;
                S++;
                curB -= x;
                curB += w;
            }
        }
    }

    static int P, S;

    static int a, b, w, x, c;

}

import java.util.*;
import java.io.*;

public class Busters {
    public static void main(String[] args) throws IOException {
        BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(rd.readLine());
        a = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        w = Integer.parseInt(st.nextToken());
        x = Integer.parseInt(st.nextToken());
        c = Integer.parseInt(st.nextToken());
        countPeriods();
        System.out.println(bin(0, Integer.MAX_VALUE));
    }

    static long bin(long a, long b){
        if(a==b) return a;
        if(b==a+1) return check(a) ? a : b;
        long m = (a+b)/2;
        return check(m) ? bin(a, m) : bin(m+1, b);
    }

    static boolean check(long X){
        long A = a - count(X), C = c-X;
        return C <= A;
    }

    static long count(long X){
        if(X<P) return simulation((int)X);
        long res = 1L*S*(X/P);
        return res + count(X % P);
    }

    static int simulation(int X){
        int num = 0;
        int B = b;
        for(int i=0; i<X; i++){
            if(B>=x){
                B -= x;
            }
            else{
                B -= x;
                B += w;
                num++;
            }
        }
        return num;
    }

    static void countPeriods(){
        int curB = b;
        boolean first = true;
        while(true){
            if(curB==b && !first) break;
            first = false;
            if(curB >= x){
                curB -= x;
                P++;
            }
            else{
                P++;
                S++;
                curB -= x;
                curB += w;
            }
        }
    }

    static int P, S;

    static int a, b, w, x, c;

}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

public class Main {

    InputReader input;
    PrintWriter output;

    void run(){
        output = new PrintWriter(new OutputStreamWriter(System.out));
        input = new InputReader(System.in);
        solve();
        output.flush();
    }

    public static void main(String[] args){
        new Main().run();
    }

    int a, b, w, x;
    int c;

    void solve() {
        a = input.ni();
        b = input.ni();
        w = input.ni();
        x = input.ni();
        c = input.ni();
        if(c <= a) {
            output.println("0");
            return;
        }
        findMin();
    }

    void findMin() {
        int lo = 1;
        int hi = 9999999;
        while(lo < hi) {
            int mid = (lo + hi)>>1;
            if(possible(mid)) {
                hi = mid;
            }
            else {
                lo = mid+1;
            }
        }
        output.println(hi);
    }

    boolean possible(int time) {
        int currA = a;
        int currB = b;
        int currC = c;
        for(int i = 0; i < time; i++) {
            currC -= 1;
            if(currB >= x) {
                currB -= x;
            }
            else {
                currA -= 1;
                currB = w - (x - currB);
            }
        }
        return currA >= currC;
    }

    class InputReader {
        private boolean finished = false;
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
                this.stream = stream;
        }

        public int read() {
                if (numChars == -1)
                        throw new InputMismatchException();
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int peek() {
                if (numChars == -1)
                        return -1;
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                return -1;
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar];
        }

        public int ni() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                int res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public long nl() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                long res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public String ns() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                StringBuilder res = new StringBuilder();
                do {
                        res.appendCodePoint(c);
                        c = read();
                } while (!isSpaceChar(c));
                return res.toString();
        }

        public boolean isSpaceChar(int c) {
                if (filter != null)
                        return filter.isSpaceChar(c);
                return isWhitespace(c);
        }

        public boolean isWhitespace(int c) {
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
                StringBuilder buf = new StringBuilder();
                int c = read();
                while (c != '\n' && c != -1) {
                        if (c != '\r')
                                buf.appendCodePoint(c);
                        c = read();
                }
                return buf.toString();
        }

        public String readLine() {
                String s = readLine0();
                while (s.trim().length() == 0)
                        s = readLine0();
                return s;
        }

        public String readLine(boolean ignoreEmptyLines) {
                if (ignoreEmptyLines)
                        return readLine();
                else
                        return readLine0();
        }

        public BigInteger readBigInteger() {
                try {
                        return new BigInteger(ns());
                } catch (NumberFormatException e) {
                        throw new InputMismatchException();
                }
        }

        public char readCharacter() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                return (char) c;
        }

        public double readDouble() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                double res = 0;
                while (!isSpaceChar(c) && c != '.') {
                        if (c == 'e' || c == 'E')
                                return res * Math.pow(10, ni());
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                }
                if (c == '.') {
                        c = read();
                        double m = 1;
                        while (!isSpaceChar(c)) {
                                if (c == 'e' || c == 'E')
                                        return res * Math.pow(10, ni());
                                if (c < '0' || c > '9')
                                        throw new InputMismatchException();
                                m /= 10;
                                res += (c - '0') * m;
                                c = read();
                        }
                }
                return res * sgn;
        }

        public boolean eof() {
                int value;
                while (isSpaceChar(value = peek()) && value != -1)
                        read();
                return value == -1;
        }

        public String next() {
                return ns();
        }

        public SpaceCharFilter getFilter() {
                return filter;
        }

        public void setFilter(SpaceCharFilter filter) {
                this.filter = filter;
        }

    }
     public interface SpaceCharFilter {
         public boolean isSpaceChar(int ch);
     }

}

import java.io.*;
import java.util.*;

public class codef382b {
	public static void main(String args[]) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String[] arrs = in.readLine().split("\\s");

		int a = Integer.parseInt(arrs[0]);
		int b = Integer.parseInt(arrs[1]);
		int w = Integer.parseInt(arrs[2]);
		int x = Integer.parseInt(arrs[3]);
		int c = Integer.parseInt(arrs[4]);

		long n = 0;

		while(a < c) {
			int cycle = w;
			int aperc = x;
			int cycles = 0;
			while(a - (cycles * aperc) < c - (cycles * cycle)) {
				cycles++;
			}
			cycles--;

			n += (cycles * cycle);
			a -= (aperc * cycles);
			c -= (cycles * cycle);

			while(a < c) {
				c--;
				n++;

				if(b < x) {
					b += (w - x);
					a--;
				}
				else {
					b -= x;
				}
			}
		}

		System.out.println(n);
	}
}

import java.io.*;

public class codef382b {
	public static void main(String args[]) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String[] arrs = in.readLine().split("\\s");

		int a = Integer.parseInt(arrs[0]);
		int b = Integer.parseInt(arrs[1]);
		int w = Integer.parseInt(arrs[2]);
		int x = Integer.parseInt(arrs[3]);
		int c = Integer.parseInt(arrs[4]);

		long n = 0;

		while(a < c) {
			int cycle = w + x;
			int aperc = x;
			int cycles = 0;
			while(a - (cycles * aperc) < c - (cycles * cycle)) {
				cycles++;
			}

			n = ((--cycles) * cycle) + (cycles > 0?1:0);
			a -= (aperc * cycles);
			c -= (cycles * cycle);

			while(a < c) {
				c--;
				n++;

				if(b < x) {
					b += (w - x);
					a--;
				}
				else {
					b -= x;
				}
			}
		}

		System.out.println(n);
	}
}

import java.io.IOException;
import java.util.Arrays;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin <aladdin3>
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader jin, PrintWriter jout) {
        int a = jin.integer();
        int b = jin.integer();
        int w = jin.integer();
        int x = jin.integer();
        int c = jin.integer();

        int[] times = new int[w + 1];
        times[0] = 0;
        for(int i = 1; i <= w; i++) {
            times[i] = times[i - 1];
            if(i % x == 0) times[i]++;
            //jout.println(i + "->" + times[i]);
        }
        int[] start = new int[w + 1];
        int[] value = new int[w + 1];
        Arrays.fill(start, -1);
        int count = 0;
        int diff = c - a;
        while(diff > 0) {
            if(start[b] != -1) {
                int time = count - start[b];
                int tdiff = value[b] - diff;
                int cost = (diff % tdiff == 0)? 1: 0;
                count += ((diff / tdiff) - cost) * time;
                diff = diff % time;
                if(diff == 0) count--;
                Arrays.fill(start, -1);
            }
            start[b] = count;
            value[b] = diff;
            if(diff <= times[b]) {
                count += diff;
                diff = 0;
            } else {
                count += times[b] + 1;
                diff -= times[b];
                b = b + (w - ((times[b] + 1) * x));
            }
        }
        jout.println(count);

    }
}

class InputReader {
    private static final int bufferMaxLength = 1024;
    private InputStream in;
    private byte[] buffer;
    private int currentBufferSize;
    private int currentBufferTop;
    private static final String tokenizers = " \t\r\f\n";

    public InputReader(InputStream stream) {
        this.in = stream;
        buffer = new byte[bufferMaxLength];
        currentBufferSize = 0;
        currentBufferTop = 0;
    }

    private boolean refill() {
        try {
            this.currentBufferSize = this.in.read(this.buffer);
            this.currentBufferTop = 0;
        } catch(Exception e) {}
        return this.currentBufferSize > 0;
    }

    private Byte readChar() {
        if(currentBufferTop < currentBufferSize) {
            return this.buffer[this.currentBufferTop++];
        } else {
            if(!this.refill()) {
                return null;
            } else {
                return readChar();
            }
        }
    }

    public String token()  {
        StringBuffer tok = new StringBuffer();
        Byte first;
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));
        if(first == null) return null;
        tok.append((char)first.byteValue());
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {
            tok.append((char)first.byteValue());
        }
        return tok.toString();
    }

    public Integer integer() throws NumberFormatException {
        String tok = token();
        return tok == null? null : Integer.parseInt(tok);
    }

    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strings = reader.readLine().split(" ");
		int a = Integer.valueOf(strings[0]);
		int b = Integer.valueOf(strings[1]);
		int w = Integer.valueOf(strings[2]);
		int x = Integer.valueOf(strings[3]);
		int c = Integer.valueOf(strings[4]);
		int n = ((c - a) * w - b + w - x - 1) / (w - x);
		System.out.println(n < 0 ? 0 : n);

	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class NumberBusters {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int A = sc.nextInt();
        int B = sc.nextInt();
        int W = sc.nextInt();
        int X = sc.nextInt();
        int C = sc.nextInt();

        int left = 0;
        int rite = 2000000000;
        int good = -1;
        while (left <= rite) {
        	int mid = (left + rite) / 2;
        	int currC = C - mid;
        	int currA = A - (W - B - 1 + mid * X) / W;
        	if (currC <= currA) {
        		good = mid;
        		rite = mid - 1;
        	} else {
        		left = mid + 1;
        	}
        }
        System.out.println(good);
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try { str = br.readLine(); }
            catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }
}

import java.io.*;
import java.util.*;

public class B {
    public static void main(String[] args) throws Exception {
        new B().solve();
        // new FileInputStream(new File("input.txt")),
        // new PrintStream(new FileOutputStream(new File("output.txt"))));
    }

    void solve() throws IOException {
        BufferedReader in = new BufferedReader(new
                InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        String[] sp;

        sp = in.readLine().split(" ");
        long a = Integer.parseInt(sp[0]);
        int b = Integer.parseInt(sp[1]);
        int w = Integer.parseInt(sp[2]);
        int x = Integer.parseInt(sp[3]);
        long c = Integer.parseInt(sp[4]);

        // loop
        int T = 0;
        long[] am = new long[10000];
        int[] bb = new int[10000];
        bb[0] = b;
        do {
            if (bb[T] >= x) {
                bb[T + 1] = bb[T] - x;
            } else {
                am[T + 1] = am[T] + 1;
                bb[T + 1] = w - (x - bb[T]);
            }
            T++;
        } while (bb[T] != b);

        long up = Long.MAX_VALUE / 4;
        long btm = -1;
        while (up - btm > 1) {
            long m = (up + btm) / 2;

            long aa = a - (m / T * am[T] + am[(int) (m % T)]);
            long cc = c - m;

            if (cc <= aa) {
                up = m;
            } else {
                btm = m;
            }
        }
        System.out.println(up);
    }
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author nasko
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long start = 0;
        long end = 1000000000000000000L;

        long best = end;
        while(start < end) {

            long mid = ( start + end )  >> 1L;

            long tempC = c - mid;
            long tempA = a - (  mid* x ) / w;

            long tempB = ( b + mid*x) % w;

            if(tempC <= tempA) {
                best = Math.min(best,mid);
                end = mid;
            } else start = mid + 1;
        }
        out.println(best);

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author nasko
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long start = 0;
        long end = 1000000000000000000L;

        long best = end;
        while(start < end) {

            long mid = ( start + end )  >> 1L;

            long tempC = c - mid;
            long tempA = a - (  mid* x ) / w;

            long tempB = ( b + mid*x) % w;

            if(tempC <= tempA) {
                best = Math.min(best,mid);
                end = mid;
            } else start = mid + 1;
        }
        out.println(start);

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author nasko
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long start = 0;
        long end = 1000000000;

        long best = end;
        while(start < end) {

            long mid = ( start + end )  >> 1L;

            long tempC = c - mid;
            long tempA = a - (  mid* x ) / w;

            long tempB = ( b + mid*x) % w;

            if(tempC <= tempA) {
                best = Math.min(best,mid);
                end = mid;
            } else start = mid + 1;
        }
        out.println(best);

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author nasko
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long start = 0;
        long end = 1000000000;

        long best = end;
        while(start < end) {

            long mid = ( start + end )  >> 1L;

            long tempC = c - mid;
            long tempA = a - (  mid* x ) / w;

            long tempB = ( b + mid*x) % w;

            if(tempC <= tempA) {
                best = Math.min(best,mid);
                end = mid;
            } else start = mid + 1;
        }
        out.println(start);

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class h {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextInt();
        long b = in.nextInt();
        long w = in.nextInt();
        long x = in.nextInt();
        long c = in.nextInt();

        long low = 0, high = 100L;
        while (low < high) {
            long mid = (low + high) >> 1L;
            long nowC = c - mid;
            long delta = mid * x;
            long nowA = a - delta / w;
            delta %= w;
            if (delta > b) {
                --nowA;
            }
            if (nowC <= nowA) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        out.println(low);
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

import java.util.Scanner;

public class B_224 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int w = in.nextInt();
		int x = in.nextInt();
		int c = in.nextInt();
		int start = 0;
//		while(b<x){
//			b = w - x + b;
//			a--;
//			c--;
//			start++;
//		}
//		int zero = w+b-x;
//		int modZero = w-(zero-x);
//		b = modZero;
//		System.out.println("b="+b);
		b = w-b-1;
		long lo = 0;
		long hi = 4*(long)10e9;
		while(lo < hi){
			long k = (lo+hi)/2;
			//System.out.println("k="+k);
			long bb = (b+k*x)%w;
			long aa = a - (b+k*x) / w;
			long cc = c - k;
			if(cc <= aa){
				hi = k;
			} else{
				lo = k+1;
			}
		}
		System.out.println((lo+start));
		//System.out.println(start);
	}

}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.net.ssl.SSLContext;

public class Main
{
	/********************************************** a list of common variables **********************************************/
	private MyScanner scan = new MyScanner();
	private PrintWriter out = new PrintWriter(System.out);
	private final double PI = Math.acos(-1.0);
	private final double EPS = 1e-6;
	private final int SIZEN = (int)(1e5);
	private final int MOD = (int)(1e9 + 7);
	private final long MODH = 10000000007L, BASE = 10007;
	private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};
	private ArrayList<Integer>[] edge;

	public void foo()
	{
		int a = scan.nextInt();
		int b = scan.nextInt();
		int w = scan.nextInt();
		int x = scan.nextInt();
		int c = scan.nextInt();
		if(b / x >= c - a)
		{
			out.println(Math.max(c - a, 0));
			return;
		}
		long ans = b / x;
		c -= b / x;
		b %= x;
		boolean[] vis = new boolean[x];
		vis[b] = true;
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		long sum1 = 0, sum2 = 0;
		while(true)
		{
			int k1 = (w - b - 1) / (w - x);
			int k2 = (b + (w - x) * k1) / x;
			b = (b + (w - x) * k1) % x;
			arr1.add(k1);
			arr2.add(k2);
			sum1 += k1 + k2;
			sum2 += k2;
			if(vis[b]) break;
			vis[b] = true;
		}
		int d = c - a;
		ans += d / sum2 * sum1;
		d %= sum2;
		if(d > 0)
		{
			for(int i = 0;i < arr1.size();++i)
			{
				if(d <= arr2.get(i))
				{
					ans += arr1.get(i) + d;
					break;
				}
				else
				{
					ans += arr1.get(i) + arr2.get(i);
					d -= arr2.get(i);
				}
			}
		}
		out.println(ans);
  	}

	public static void main(String[] args)
	{
		Main m = new Main();
		m.foo();
		m.out.close();
	}

	class Point
	{
		private int x;
		private int y;
		public Point(int aX, int aY)
		{
			x = aX;
			y = aY;
		}
	}

	/********************************************** a list of common algorithms **********************************************/
	/**
	 * 1---Get greatest common divisor
	 * @param a :	first number
	 * @param b :	second number
	 * @return		greatest common divisor
	 */
	public long gcd(long a, long b)
	{
		return 0 == b ? a : gcd(b, a % b);
	}

	/**
	 * 2---Get the distance from a point to a line
	 * @param x1	the x coordinate of one endpoint of the line
	 * @param y1	the y coordinate of one endpoint of the line
	 * @param x2	the x coordinate of the other endpoint of the line
	 * @param y2	the y coordinate of the other endpoint of the line
	 * @param x		the x coordinate of the point
	 * @param y		the x coordinate of the point
	 * @return		the distance from a point to a line
	 */
	public double getDist(long x1, long y1, long x2, long y2, long x, long y)
	{
		long a = y2 - y1;
		long b = x1 - x2;
		long c = y1 * (x2 - x1) - x1 * (y2 - y1);
		return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
	}

	/**
	 * 3---Get the distance from one point to a segment (not a line)
	 * @param x1	the x coordinate of one endpoint of the segment
	 * @param y1	the y coordinate of one endpoint of the segment
	 * @param x2	the x coordinate of the other endpoint of the segment
	 * @param y2	the y coordinate of the other endpoint of the segment
	 * @param x		the x coordinate of the point
	 * @param y		the y coordinate of the point
	 * @return		the distance from one point to a segment (not a line)
	 */
	public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
		if(cross <= 0)
		{
			return (x - x1) * (x - x1) + (y - y1) * (y - y1);
		}
		double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
		if(cross >= d)
		{
			return (x - x2) * (x - x2) + (y - y2) * (y - y2);
		}
		double r = cross / d;
		double px = x1 + (x2 - x1) * r;
		double py = y1 + (y2 - y1) * r;
		return (x - px) * (x - px) + (y - py) * (y - py);
	}

	/**
	 * 4---KMP match, i.e. kmpMatch("abcd", "bcd") = 1, kmpMatch("abcd", "bfcd") = -1.
	 * @param t:	String to match.
	 * @param p:	String to be matched.
	 * @return		if can match, first index; otherwise -1.
	 */
	public int kmpMatch(char[] t, char[] p)
	{
		int n = t.length;
		int m = p.length;
		int[] next = new int[m + 1];
		next[0] = -1;
		int j = -1;
		for(int i = 1;i < m;++i)
		{
			while(j >= 0 && p[i] != p[j + 1])
			{
				j = next[j];
			}
			if(p[i] == p[j + 1])
			{
				++j;
			}
			next[i] = j;
		}
		j = -1;
		for(int i = 0;i < n;++i)
		{
			while(j >= 0 && t[i] != p[j + 1])
			{
				j = next[j];
			}
			if(t[i] == p[j + 1])
			{
				++j;
			}
			if(j == m - 1)
			{
				return i - m + 1;
			}
		}
		return -1;
	}

	/**
	 * 5---Get the hash code of a String
	 * @param	s:	input string
	 * @return	hash code
	 */
	public long hash(String s)
	{
		long key = 0, t = 1;
		for(int i = 0;i < s.length();++i)
		{
			key = (key + s.charAt(i) * t) % MODH;
			t = t * BASE % MODH;
		}
		return key;
	}

	/**
	 * 6---Get x ^ n % MOD quickly.
	 * @param	x:	base
	 * @param 	n:	times
	 * @return	x ^ n % MOD
	 */
	public long quickMod(long x, long n)
	{
		long ans = 1;
		while(n > 0)
		{
			if(1 == n % 2)
			{
				ans = ans * x % MOD;
 			}
			x = x * x % MOD;
			n >>= 1;
		}
		return ans;
	}

	/**
	 * 7---judge if a point is located inside a polygon
	 * @param x0	the x coordinate of the point
	 * @param y0	the y coordinate of the point
	 * @return true if it is inside the polygon, otherwise false
	 */
	/*public boolean contains(double x0, double y0)
	{
		int cross = 0;
		for(int i = 0;i < n;++i)
		{
			double s = x[i + 1] == x[i] ? 100000000 : (double)(y[i + 1] - y[i]) / (x[i + 1] - x[i]);
			boolean b1 = x[i] <= x0 && x0 < x[i + 1];
			boolean b2 = x[i + 1] <= x0 && x0 < x[i];
			boolean b3 = y0 < s * (x0 - x[i]) + y[i];
			if((b1 || b2) && b3) ++cross;
		}
		return cross % 2 != 0;
	}*/

	/**
	 * 8---judge if a point is located on the segment
	 * @param	x1	the x coordinate of one point of the segment
	 * @param	y1	the y coordinate of one point of the segment
	 * @param 	x2	the x coordinate of another point of the segment
	 * @param 	y2	the y coordinate of another point of the segment
	 * @param	x	the x coordinate of the point
	 * @param 	y	the y coordinate of the point
	 * @return	true if it is located on the segment, otherwise false
	 */
	public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&
				x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&
				y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
	}

	/**
	 * 9---get the cross product
	 * @param 	p1	point A
	 * @param 	p2	point B
	 * @param 	p	point O
	 * @return	cross product of OA x OB
	 */
	public long cross(Point p1, Point p2, Point p)
	{
		return (long)(p1.x - p.x) * (p2.y - p.y) - (long)(p2.x - p.x) * (p1.y - p.y);
	}

	class MyScanner
	{
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    BufferedInputStream bis = new BufferedInputStream(System.in);

	    public int read()
	    {
	        if (-1 == numChars)
	        {
	        	throw new InputMismatchException();
	        }
	        if (curChar >= numChars)
	        {
	            curChar = 0;
	            try
	            {
	                numChars = bis.read(buf);
	            }
	            catch (IOException e)
	            {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	            {
	            	return -1;
	            }
	        }
	        return buf[curChar++];
	    }

	    public int nextInt()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do
	        {
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong()
	    {
	    	int c = read();
	    	while (isSpaceChar(c))
	    	{
	    		c = read();
	    	}
	    	int sgn = 1;
	    	if (c == '-')
	    	{
	    		sgn = -1;
	    		c = read();
	    	}
	    	long res = 0;
	    	do
	    	{
	    		if (c < '0' || c > '9')
	    		{
	    			throw new InputMismatchException();
	    		}
	    		res *= 10;
	    		res += c - '0';
	    		c = read();
	    	} while (!isSpaceChar(c));
	    	return res * sgn;
	    }

	    public double nextDouble()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.')
	        {
	            if (c == 'e' || c == 'E')
	            {
	            	return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c & 15;
	            c = read();
	        }
	        if (c == '.')
	        {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c))
	            {
	                if (c == 'e' || c == 'E')
	                {
	                	return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9')
	                {
	                	throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c & 15) * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public String next()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        StringBuilder res = new StringBuilder();
	        do
	        {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    private boolean isSpaceChar(int c)
	    {
	        return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;
	    }
	}
}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.net.ssl.SSLContext;

public class Main
{
	/********************************************** a list of common variables **********************************************/
	private MyScanner scan = new MyScanner();
	private PrintWriter out = new PrintWriter(System.out);
	private final double PI = Math.acos(-1.0);
	private final double EPS = 1e-6;
	private final int SIZEN = (int)(1e5);
	private final int MOD = (int)(1e9 + 7);
	private final long MODH = 10000000007L, BASE = 10007;
	private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};
	private ArrayList<Integer>[] edge;

	public void foo()
	{
		int a = scan.nextInt();
		int b = scan.nextInt();
		int w = scan.nextInt();
		int x = scan.nextInt();
		int c = scan.nextInt();
		if(b / x >= c - a)
		{
			out.println(Math.max(c - a, 0));
			return;
		}
		long ans = b / x;
		c -= b / x;
		b %= x;
		int[] index = new int[x];
		Arrays.fill(index, -1);
		index[b] = 0;
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		int p = 1;
		while(true)
		{
			int k1 = (w - b - 1) / (w - x);
			int k2 = (b + (w - x) * k1) / x;
			b = (b + (w - x) * k1) % x;
			arr1.add(k1);
			arr2.add(k2);
			if(index[b] != -1)
			{
				p = index[b];
				break;
			}
			index[b] = p++;
		}
		long sum1 = 0, sum2 = 0;
		for(int i = p;i < arr1.size();++i)
		{
			sum1 += arr1.get(i);
			sum2 += arr2.get(i);
		}
		sum1 += sum2;
		int d = c - a;
		ans += d / sum2 * sum1;
		d %= sum2;
		if(d > 0)
		{
			for(int i = 0;i < arr1.size();++i)
			{
				if(d <= arr2.get(i))
				{
					ans += arr1.get(i) + d;
					break;
				}
				else
				{
					ans += arr1.get(i) + arr2.get(i);
					d -= arr2.get(i);
				}
			}
		}
		out.println(ans);
  	}

	public static void main(String[] args)
	{
		Main m = new Main();
		m.foo();
		m.out.close();
	}

	class Point
	{
		private int x;
		private int y;
		public Point(int aX, int aY)
		{
			x = aX;
			y = aY;
		}
	}

	/********************************************** a list of common algorithms **********************************************/
	/**
	 * 1---Get greatest common divisor
	 * @param a :	first number
	 * @param b :	second number
	 * @return		greatest common divisor
	 */
	public long gcd(long a, long b)
	{
		return 0 == b ? a : gcd(b, a % b);
	}

	/**
	 * 2---Get the distance from a point to a line
	 * @param x1	the x coordinate of one endpoint of the line
	 * @param y1	the y coordinate of one endpoint of the line
	 * @param x2	the x coordinate of the other endpoint of the line
	 * @param y2	the y coordinate of the other endpoint of the line
	 * @param x		the x coordinate of the point
	 * @param y		the x coordinate of the point
	 * @return		the distance from a point to a line
	 */
	public double getDist(long x1, long y1, long x2, long y2, long x, long y)
	{
		long a = y2 - y1;
		long b = x1 - x2;
		long c = y1 * (x2 - x1) - x1 * (y2 - y1);
		return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
	}

	/**
	 * 3---Get the distance from one point to a segment (not a line)
	 * @param x1	the x coordinate of one endpoint of the segment
	 * @param y1	the y coordinate of one endpoint of the segment
	 * @param x2	the x coordinate of the other endpoint of the segment
	 * @param y2	the y coordinate of the other endpoint of the segment
	 * @param x		the x coordinate of the point
	 * @param y		the y coordinate of the point
	 * @return		the distance from one point to a segment (not a line)
	 */
	public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
		if(cross <= 0)
		{
			return (x - x1) * (x - x1) + (y - y1) * (y - y1);
		}
		double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
		if(cross >= d)
		{
			return (x - x2) * (x - x2) + (y - y2) * (y - y2);
		}
		double r = cross / d;
		double px = x1 + (x2 - x1) * r;
		double py = y1 + (y2 - y1) * r;
		return (x - px) * (x - px) + (y - py) * (y - py);
	}

	/**
	 * 4---KMP match, i.e. kmpMatch("abcd", "bcd") = 1, kmpMatch("abcd", "bfcd") = -1.
	 * @param t:	String to match.
	 * @param p:	String to be matched.
	 * @return		if can match, first index; otherwise -1.
	 */
	public int kmpMatch(char[] t, char[] p)
	{
		int n = t.length;
		int m = p.length;
		int[] next = new int[m + 1];
		next[0] = -1;
		int j = -1;
		for(int i = 1;i < m;++i)
		{
			while(j >= 0 && p[i] != p[j + 1])
			{
				j = next[j];
			}
			if(p[i] == p[j + 1])
			{
				++j;
			}
			next[i] = j;
		}
		j = -1;
		for(int i = 0;i < n;++i)
		{
			while(j >= 0 && t[i] != p[j + 1])
			{
				j = next[j];
			}
			if(t[i] == p[j + 1])
			{
				++j;
			}
			if(j == m - 1)
			{
				return i - m + 1;
			}
		}
		return -1;
	}

	/**
	 * 5---Get the hash code of a String
	 * @param	s:	input string
	 * @return	hash code
	 */
	public long hash(String s)
	{
		long key = 0, t = 1;
		for(int i = 0;i < s.length();++i)
		{
			key = (key + s.charAt(i) * t) % MODH;
			t = t * BASE % MODH;
		}
		return key;
	}

	/**
	 * 6---Get x ^ n % MOD quickly.
	 * @param	x:	base
	 * @param 	n:	times
	 * @return	x ^ n % MOD
	 */
	public long quickMod(long x, long n)
	{
		long ans = 1;
		while(n > 0)
		{
			if(1 == n % 2)
			{
				ans = ans * x % MOD;
 			}
			x = x * x % MOD;
			n >>= 1;
		}
		return ans;
	}

	/**
	 * 7---judge if a point is located inside a polygon
	 * @param x0	the x coordinate of the point
	 * @param y0	the y coordinate of the point
	 * @return true if it is inside the polygon, otherwise false
	 */
	/*public boolean contains(double x0, double y0)
	{
		int cross = 0;
		for(int i = 0;i < n;++i)
		{
			double s = x[i + 1] == x[i] ? 100000000 : (double)(y[i + 1] - y[i]) / (x[i + 1] - x[i]);
			boolean b1 = x[i] <= x0 && x0 < x[i + 1];
			boolean b2 = x[i + 1] <= x0 && x0 < x[i];
			boolean b3 = y0 < s * (x0 - x[i]) + y[i];
			if((b1 || b2) && b3) ++cross;
		}
		return cross % 2 != 0;
	}*/

	/**
	 * 8---judge if a point is located on the segment
	 * @param	x1	the x coordinate of one point of the segment
	 * @param	y1	the y coordinate of one point of the segment
	 * @param 	x2	the x coordinate of another point of the segment
	 * @param 	y2	the y coordinate of another point of the segment
	 * @param	x	the x coordinate of the point
	 * @param 	y	the y coordinate of the point
	 * @return	true if it is located on the segment, otherwise false
	 */
	public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&
				x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&
				y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
	}

	/**
	 * 9---get the cross product
	 * @param 	p1	point A
	 * @param 	p2	point B
	 * @param 	p	point O
	 * @return	cross product of OA x OB
	 */
	public long cross(Point p1, Point p2, Point p)
	{
		return (long)(p1.x - p.x) * (p2.y - p.y) - (long)(p2.x - p.x) * (p1.y - p.y);
	}

	class MyScanner
	{
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    BufferedInputStream bis = new BufferedInputStream(System.in);

	    public int read()
	    {
	        if (-1 == numChars)
	        {
	        	throw new InputMismatchException();
	        }
	        if (curChar >= numChars)
	        {
	            curChar = 0;
	            try
	            {
	                numChars = bis.read(buf);
	            }
	            catch (IOException e)
	            {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	            {
	            	return -1;
	            }
	        }
	        return buf[curChar++];
	    }

	    public int nextInt()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do
	        {
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong()
	    {
	    	int c = read();
	    	while (isSpaceChar(c))
	    	{
	    		c = read();
	    	}
	    	int sgn = 1;
	    	if (c == '-')
	    	{
	    		sgn = -1;
	    		c = read();
	    	}
	    	long res = 0;
	    	do
	    	{
	    		if (c < '0' || c > '9')
	    		{
	    			throw new InputMismatchException();
	    		}
	    		res *= 10;
	    		res += c - '0';
	    		c = read();
	    	} while (!isSpaceChar(c));
	    	return res * sgn;
	    }

	    public double nextDouble()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.')
	        {
	            if (c == 'e' || c == 'E')
	            {
	            	return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c & 15;
	            c = read();
	        }
	        if (c == '.')
	        {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c))
	            {
	                if (c == 'e' || c == 'E')
	                {
	                	return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9')
	                {
	                	throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c & 15) * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public String next()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        StringBuilder res = new StringBuilder();
	        do
	        {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    private boolean isSpaceChar(int c)
	    {
	        return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;
	    }
	}
}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.net.ssl.SSLContext;

public class Main
{
	/********************************************** a list of common variables **********************************************/
	private MyScanner scan = new MyScanner();
	private PrintWriter out = new PrintWriter(System.out);
	private final double PI = Math.acos(-1.0);
	private final double EPS = 1e-6;
	private final int SIZEN = (int)(1e5);
	private final int MOD = (int)(1e9 + 7);
	private final long MODH = 10000000007L, BASE = 10007;
	private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};
	private ArrayList<Integer>[] edge;

	public void foo()
	{
		int a = scan.nextInt();
		int b = scan.nextInt();
		int w = scan.nextInt();
		int x = scan.nextInt();
		int c = scan.nextInt();
		if(b / x >= c - a)
		{
			out.println(Math.max(c - a, 0));
			return;
		}
		long ans = b / x;
		c -= b / x;
		b %= x;
		int[] index = new int[x];
		Arrays.fill(index, -1);
		index[b] = 0;
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		int p = 1;
		while(true)
		{
			int k1 = (w - b - 1) / (w - x);
			int k2 = (b + (w - x) * k1) / x;
			b = (b + (w - x) * k1) % x;
			arr1.add(k1);
			arr2.add(k2);
			if(index[b] != -1)
			{
				p = index[b];
				break;
			}
			index[b] = p++;
		}
		int d = c - a;
		for(int i = 0;i < p;++i)
		{
			if(d <= arr2.get(i))
			{
				ans += arr1.get(i) + d;
				d = 0;
				break;
			}
			else
			{
				ans += arr1.get(i) + arr2.get(i);
				d -= arr2.get(i);
			}
		}
		if(0 == d)
		{
			out.println(ans);
			return;
		}
		long sum1 = 0, sum2 = 0;
		for(int i = p;i < arr1.size();++i)
		{
			sum1 += arr1.get(i);
			sum2 += arr2.get(i);
		}
		sum1 += sum2;
		ans += d / sum2 * sum1;
		d %= sum2;
		if(d > 0)
		{
			for(int i = 0;i < arr1.size();++i)
			{
				if(d <= arr2.get(i))
				{
					ans += arr1.get(i) + d;
					break;
				}
				else
				{
					ans += arr1.get(i) + arr2.get(i);
					d -= arr2.get(i);
				}
			}
		}
		out.println(ans);
  	}

	public static void main(String[] args)
	{
		Main m = new Main();
		m.foo();
		m.out.close();
	}

	class Point
	{
		private int x;
		private int y;
		public Point(int aX, int aY)
		{
			x = aX;
			y = aY;
		}
	}

	/********************************************** a list of common algorithms **********************************************/
	/**
	 * 1---Get greatest common divisor
	 * @param a :	first number
	 * @param b :	second number
	 * @return		greatest common divisor
	 */
	public long gcd(long a, long b)
	{
		return 0 == b ? a : gcd(b, a % b);
	}

	/**
	 * 2---Get the distance from a point to a line
	 * @param x1	the x coordinate of one endpoint of the line
	 * @param y1	the y coordinate of one endpoint of the line
	 * @param x2	the x coordinate of the other endpoint of the line
	 * @param y2	the y coordinate of the other endpoint of the line
	 * @param x		the x coordinate of the point
	 * @param y		the x coordinate of the point
	 * @return		the distance from a point to a line
	 */
	public double getDist(long x1, long y1, long x2, long y2, long x, long y)
	{
		long a = y2 - y1;
		long b = x1 - x2;
		long c = y1 * (x2 - x1) - x1 * (y2 - y1);
		return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
	}

	/**
	 * 3---Get the distance from one point to a segment (not a line)
	 * @param x1	the x coordinate of one endpoint of the segment
	 * @param y1	the y coordinate of one endpoint of the segment
	 * @param x2	the x coordinate of the other endpoint of the segment
	 * @param y2	the y coordinate of the other endpoint of the segment
	 * @param x		the x coordinate of the point
	 * @param y		the y coordinate of the point
	 * @return		the distance from one point to a segment (not a line)
	 */
	public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
		if(cross <= 0)
		{
			return (x - x1) * (x - x1) + (y - y1) * (y - y1);
		}
		double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
		if(cross >= d)
		{
			return (x - x2) * (x - x2) + (y - y2) * (y - y2);
		}
		double r = cross / d;
		double px = x1 + (x2 - x1) * r;
		double py = y1 + (y2 - y1) * r;
		return (x - px) * (x - px) + (y - py) * (y - py);
	}

	/**
	 * 4---KMP match, i.e. kmpMatch("abcd", "bcd") = 1, kmpMatch("abcd", "bfcd") = -1.
	 * @param t:	String to match.
	 * @param p:	String to be matched.
	 * @return		if can match, first index; otherwise -1.
	 */
	public int kmpMatch(char[] t, char[] p)
	{
		int n = t.length;
		int m = p.length;
		int[] next = new int[m + 1];
		next[0] = -1;
		int j = -1;
		for(int i = 1;i < m;++i)
		{
			while(j >= 0 && p[i] != p[j + 1])
			{
				j = next[j];
			}
			if(p[i] == p[j + 1])
			{
				++j;
			}
			next[i] = j;
		}
		j = -1;
		for(int i = 0;i < n;++i)
		{
			while(j >= 0 && t[i] != p[j + 1])
			{
				j = next[j];
			}
			if(t[i] == p[j + 1])
			{
				++j;
			}
			if(j == m - 1)
			{
				return i - m + 1;
			}
		}
		return -1;
	}

	/**
	 * 5---Get the hash code of a String
	 * @param	s:	input string
	 * @return	hash code
	 */
	public long hash(String s)
	{
		long key = 0, t = 1;
		for(int i = 0;i < s.length();++i)
		{
			key = (key + s.charAt(i) * t) % MODH;
			t = t * BASE % MODH;
		}
		return key;
	}

	/**
	 * 6---Get x ^ n % MOD quickly.
	 * @param	x:	base
	 * @param 	n:	times
	 * @return	x ^ n % MOD
	 */
	public long quickMod(long x, long n)
	{
		long ans = 1;
		while(n > 0)
		{
			if(1 == n % 2)
			{
				ans = ans * x % MOD;
 			}
			x = x * x % MOD;
			n >>= 1;
		}
		return ans;
	}

	/**
	 * 7---judge if a point is located inside a polygon
	 * @param x0	the x coordinate of the point
	 * @param y0	the y coordinate of the point
	 * @return true if it is inside the polygon, otherwise false
	 */
	/*public boolean contains(double x0, double y0)
	{
		int cross = 0;
		for(int i = 0;i < n;++i)
		{
			double s = x[i + 1] == x[i] ? 100000000 : (double)(y[i + 1] - y[i]) / (x[i + 1] - x[i]);
			boolean b1 = x[i] <= x0 && x0 < x[i + 1];
			boolean b2 = x[i + 1] <= x0 && x0 < x[i];
			boolean b3 = y0 < s * (x0 - x[i]) + y[i];
			if((b1 || b2) && b3) ++cross;
		}
		return cross % 2 != 0;
	}*/

	/**
	 * 8---judge if a point is located on the segment
	 * @param	x1	the x coordinate of one point of the segment
	 * @param	y1	the y coordinate of one point of the segment
	 * @param 	x2	the x coordinate of another point of the segment
	 * @param 	y2	the y coordinate of another point of the segment
	 * @param	x	the x coordinate of the point
	 * @param 	y	the y coordinate of the point
	 * @return	true if it is located on the segment, otherwise false
	 */
	public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&
				x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&
				y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
	}

	/**
	 * 9---get the cross product
	 * @param 	p1	point A
	 * @param 	p2	point B
	 * @param 	p	point O
	 * @return	cross product of OA x OB
	 */
	public long cross(Point p1, Point p2, Point p)
	{
		return (long)(p1.x - p.x) * (p2.y - p.y) - (long)(p2.x - p.x) * (p1.y - p.y);
	}

	class MyScanner
	{
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    BufferedInputStream bis = new BufferedInputStream(System.in);

	    public int read()
	    {
	        if (-1 == numChars)
	        {
	        	throw new InputMismatchException();
	        }
	        if (curChar >= numChars)
	        {
	            curChar = 0;
	            try
	            {
	                numChars = bis.read(buf);
	            }
	            catch (IOException e)
	            {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	            {
	            	return -1;
	            }
	        }
	        return buf[curChar++];
	    }

	    public int nextInt()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do
	        {
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong()
	    {
	    	int c = read();
	    	while (isSpaceChar(c))
	    	{
	    		c = read();
	    	}
	    	int sgn = 1;
	    	if (c == '-')
	    	{
	    		sgn = -1;
	    		c = read();
	    	}
	    	long res = 0;
	    	do
	    	{
	    		if (c < '0' || c > '9')
	    		{
	    			throw new InputMismatchException();
	    		}
	    		res *= 10;
	    		res += c - '0';
	    		c = read();
	    	} while (!isSpaceChar(c));
	    	return res * sgn;
	    }

	    public double nextDouble()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.')
	        {
	            if (c == 'e' || c == 'E')
	            {
	            	return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c & 15;
	            c = read();
	        }
	        if (c == '.')
	        {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c))
	            {
	                if (c == 'e' || c == 'E')
	                {
	                	return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9')
	                {
	                	throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c & 15) * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public String next()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        StringBuilder res = new StringBuilder();
	        do
	        {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    private boolean isSpaceChar(int c)
	    {
	        return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;
	    }
	}
}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.net.ssl.SSLContext;

public class Main
{
	/********************************************** a list of common variables **********************************************/
	private MyScanner scan = new MyScanner();
	private PrintWriter out = new PrintWriter(System.out);
	private final double PI = Math.acos(-1.0);
	private final double EPS = 1e-6;
	private final int SIZEN = (int)(1e5);
	private final int MOD = (int)(1e9 + 7);
	private final long MODH = 10000000007L, BASE = 10007;
	private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};
	private ArrayList<Integer>[] edge;

	public void foo()
	{
		int a = scan.nextInt();
		int b = scan.nextInt();
		int w = scan.nextInt();
		int x = scan.nextInt();
		int c = scan.nextInt();
		if(b / x >= c - a)
		{
			out.println(c - a);
			return;
		}
		long ans = b / x;
		c -= b / x;
		b %= x;
		boolean[] vis = new boolean[x];
		vis[b] = true;
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		long sum1 = 0, sum2 = 0;
		while(true)
		{
			int k1 = (w - b - 1) / (w - x);
			int k2 = (b + (w - x) * k1) / x;
			b = (b + (w - x) * k1) % x;
			arr1.add(k1);
			arr2.add(k2);
			sum1 += k1 + k2;
			sum2 += k2;
			if(vis[b]) break;
			vis[b] = true;
		}
		int d = c - a;
		ans += d / sum2 * sum1;
		d %= sum2;
		if(d > 0)
		{
			for(int i = 0;i < arr1.size();++i)
			{
				if(d <= arr2.get(i))
				{
					ans += arr1.get(i) + d;
					break;
				}
				else
				{
					ans += arr1.get(i) + arr2.get(i);
					d -= arr2.get(i);
				}
			}
		}
		out.println(ans);
  	}

	public static void main(String[] args)
	{
		Main m = new Main();
		m.foo();
		m.out.close();
	}

	class Point
	{
		private int x;
		private int y;
		public Point(int aX, int aY)
		{
			x = aX;
			y = aY;
		}
	}

	/********************************************** a list of common algorithms **********************************************/
	/**
	 * 1---Get greatest common divisor
	 * @param a :	first number
	 * @param b :	second number
	 * @return		greatest common divisor
	 */
	public long gcd(long a, long b)
	{
		return 0 == b ? a : gcd(b, a % b);
	}

	/**
	 * 2---Get the distance from a point to a line
	 * @param x1	the x coordinate of one endpoint of the line
	 * @param y1	the y coordinate of one endpoint of the line
	 * @param x2	the x coordinate of the other endpoint of the line
	 * @param y2	the y coordinate of the other endpoint of the line
	 * @param x		the x coordinate of the point
	 * @param y		the x coordinate of the point
	 * @return		the distance from a point to a line
	 */
	public double getDist(long x1, long y1, long x2, long y2, long x, long y)
	{
		long a = y2 - y1;
		long b = x1 - x2;
		long c = y1 * (x2 - x1) - x1 * (y2 - y1);
		return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
	}

	/**
	 * 3---Get the distance from one point to a segment (not a line)
	 * @param x1	the x coordinate of one endpoint of the segment
	 * @param y1	the y coordinate of one endpoint of the segment
	 * @param x2	the x coordinate of the other endpoint of the segment
	 * @param y2	the y coordinate of the other endpoint of the segment
	 * @param x		the x coordinate of the point
	 * @param y		the y coordinate of the point
	 * @return		the distance from one point to a segment (not a line)
	 */
	public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
		if(cross <= 0)
		{
			return (x - x1) * (x - x1) + (y - y1) * (y - y1);
		}
		double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
		if(cross >= d)
		{
			return (x - x2) * (x - x2) + (y - y2) * (y - y2);
		}
		double r = cross / d;
		double px = x1 + (x2 - x1) * r;
		double py = y1 + (y2 - y1) * r;
		return (x - px) * (x - px) + (y - py) * (y - py);
	}

	/**
	 * 4---KMP match, i.e. kmpMatch("abcd", "bcd") = 1, kmpMatch("abcd", "bfcd") = -1.
	 * @param t:	String to match.
	 * @param p:	String to be matched.
	 * @return		if can match, first index; otherwise -1.
	 */
	public int kmpMatch(char[] t, char[] p)
	{
		int n = t.length;
		int m = p.length;
		int[] next = new int[m + 1];
		next[0] = -1;
		int j = -1;
		for(int i = 1;i < m;++i)
		{
			while(j >= 0 && p[i] != p[j + 1])
			{
				j = next[j];
			}
			if(p[i] == p[j + 1])
			{
				++j;
			}
			next[i] = j;
		}
		j = -1;
		for(int i = 0;i < n;++i)
		{
			while(j >= 0 && t[i] != p[j + 1])
			{
				j = next[j];
			}
			if(t[i] == p[j + 1])
			{
				++j;
			}
			if(j == m - 1)
			{
				return i - m + 1;
			}
		}
		return -1;
	}

	/**
	 * 5---Get the hash code of a String
	 * @param	s:	input string
	 * @return	hash code
	 */
	public long hash(String s)
	{
		long key = 0, t = 1;
		for(int i = 0;i < s.length();++i)
		{
			key = (key + s.charAt(i) * t) % MODH;
			t = t * BASE % MODH;
		}
		return key;
	}

	/**
	 * 6---Get x ^ n % MOD quickly.
	 * @param	x:	base
	 * @param 	n:	times
	 * @return	x ^ n % MOD
	 */
	public long quickMod(long x, long n)
	{
		long ans = 1;
		while(n > 0)
		{
			if(1 == n % 2)
			{
				ans = ans * x % MOD;
 			}
			x = x * x % MOD;
			n >>= 1;
		}
		return ans;
	}

	/**
	 * 7---judge if a point is located inside a polygon
	 * @param x0	the x coordinate of the point
	 * @param y0	the y coordinate of the point
	 * @return true if it is inside the polygon, otherwise false
	 */
	/*public boolean contains(double x0, double y0)
	{
		int cross = 0;
		for(int i = 0;i < n;++i)
		{
			double s = x[i + 1] == x[i] ? 100000000 : (double)(y[i + 1] - y[i]) / (x[i + 1] - x[i]);
			boolean b1 = x[i] <= x0 && x0 < x[i + 1];
			boolean b2 = x[i + 1] <= x0 && x0 < x[i];
			boolean b3 = y0 < s * (x0 - x[i]) + y[i];
			if((b1 || b2) && b3) ++cross;
		}
		return cross % 2 != 0;
	}*/

	/**
	 * 8---judge if a point is located on the segment
	 * @param	x1	the x coordinate of one point of the segment
	 * @param	y1	the y coordinate of one point of the segment
	 * @param 	x2	the x coordinate of another point of the segment
	 * @param 	y2	the y coordinate of another point of the segment
	 * @param	x	the x coordinate of the point
	 * @param 	y	the y coordinate of the point
	 * @return	true if it is located on the segment, otherwise false
	 */
	public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&
				x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&
				y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
	}

	/**
	 * 9---get the cross product
	 * @param 	p1	point A
	 * @param 	p2	point B
	 * @param 	p	point O
	 * @return	cross product of OA x OB
	 */
	public long cross(Point p1, Point p2, Point p)
	{
		return (long)(p1.x - p.x) * (p2.y - p.y) - (long)(p2.x - p.x) * (p1.y - p.y);
	}

	class MyScanner
	{
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    BufferedInputStream bis = new BufferedInputStream(System.in);

	    public int read()
	    {
	        if (-1 == numChars)
	        {
	        	throw new InputMismatchException();
	        }
	        if (curChar >= numChars)
	        {
	            curChar = 0;
	            try
	            {
	                numChars = bis.read(buf);
	            }
	            catch (IOException e)
	            {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	            {
	            	return -1;
	            }
	        }
	        return buf[curChar++];
	    }

	    public int nextInt()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do
	        {
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong()
	    {
	    	int c = read();
	    	while (isSpaceChar(c))
	    	{
	    		c = read();
	    	}
	    	int sgn = 1;
	    	if (c == '-')
	    	{
	    		sgn = -1;
	    		c = read();
	    	}
	    	long res = 0;
	    	do
	    	{
	    		if (c < '0' || c > '9')
	    		{
	    			throw new InputMismatchException();
	    		}
	    		res *= 10;
	    		res += c - '0';
	    		c = read();
	    	} while (!isSpaceChar(c));
	    	return res * sgn;
	    }

	    public double nextDouble()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.')
	        {
	            if (c == 'e' || c == 'E')
	            {
	            	return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c & 15;
	            c = read();
	        }
	        if (c == '.')
	        {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c))
	            {
	                if (c == 'e' || c == 'E')
	                {
	                	return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9')
	                {
	                	throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c & 15) * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public String next()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        StringBuilder res = new StringBuilder();
	        do
	        {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    private boolean isSpaceChar(int c)
	    {
	        return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;
	    }
	}
}