#define Online
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO;

delegate double F (double x);

delegate decimal Fdec (decimal x);

partial class Program
{
	public static StreamReader sr;
	public static StreamWriter sw;

	static void Main (string[] args)
	{

#if FileIO
		sr = new StreamReader ("input.in");
		sw = new StreamWriter ("input.out");
		Console.SetIn (sr);
		Console.SetOut (sw);
#endif

		B ();

#if Online
		Console.ReadLine ();
#endif

#if FileIO
		sr.Close ();
		sw.Close ();
#endif

	}

	static void A ()
	{
	}

	static void B ()
	{
		int a, b, w, x, c;
		a = NextInt ();
		b = NextInt ();
		w = NextInt ();
		x = NextInt ();
		c = NextInt ();
		long time = long.MaxValue;
		long[] t = new long[1001];
		long[] d = new long[1001];
		int[] last = new int[1001];
		long[] th = new long[1001];
		long[] th_t = new long[1001];
		int[] last_th = new int[1001];
		for (int i=0; i<t.Length; i++) {
			int _b = i;
			int j = 0;
			int cnt = 0;
			while (_b>=x) {
				_b -= x;
				++j;
			}
			while (_b<x) {
				++cnt;
				_b = w - (x - _b);
				j++;
			}
			last [i] = _b;
			t [i] = j;
			d [i] = cnt;
		}
		for (int i=0; i<t.Length; i++) {
			int _b = i;
			while (th_t[i]-th[i]<1000) {
				th [i] += d [_b];
				th_t [i] += t [_b];
				_b = last [_b];

			}
			last_th [i] = _b;
		}

		long left = 0;
		long right = time;
		long mid = 0;
		while (left<right) {
			mid = (left + right) / 2;
			time = mid;
			long _a = a;
			long _c = c;
			int _b = b;
			while (_c-th_t[_b]>_a-th[_b]) {
				_a -= th [_b];
				_c -= th_t [_b];
				time -= th_t [_b];
				_b = last_th [_b];
			}
			while (_c-t[_b]>_a-d[_b]) {
				time -= t [_b];
				_c -= t [_b];
				_a -= d [_b];
				_b = last [_b];
			}
			while (_b>=x && _c>_a) {
				--_c;
				--time;
				_b -= x;
			}
			while (_b<x && _c>_a) {
				--_a;
				--_c;
				_b = w - (x - _b);
				--time;
			}
			if (time >= 0) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		Console.WriteLine (right);
	}

	static void C ()
	{

	}

	static void D ()
	{

	}

	static void E ()
	{

	}

	static void TestGen ()
	{

	}

}

public static class MyMath
{
	public static long BinPow (long a, long n, long mod)
	{
		long res = 1;
		while (n > 0) {
			if ((n & 1) == 1) {
				res = (res * a) % mod;
			}
			a = (a * a) % mod;
			n >>= 1;
		}
		return res;
	}

	public static long GCD (long a, long b)
	{
		while (b != 0)
			b = a % (a = b);
		return a;
	}

	public static int GCD (int a, int b)
	{
		while (b != 0)
			b = a % (a = b);
		return a;
	}

	public static long LCM (long a, long b)
	{
		return (a * b) / GCD (a, b);
	}

	public static int LCM (int a, int b)
	{
		return (a * b) / GCD (a, b);
	}
}

static class ArrayUtils
{
	static void Swap<T> (T[] a, int l, int r)
	{
		T t = a [l];
		a [l] = a [r];
		a [r] = t;
	}

	public static bool NextPermutation (int[] a)
	{
		bool isOkay = false;
		int n = a.Length;
		for (int i=n-2; i>=0; i--) {
			if (a [i] < a [i + 1]) {
				isOkay = true;
				int j = i + 1;
				while (j+1<n && a[j+1]>a[i]) {
					j++;
				}
				Swap (a, i, j);
				for (j=1; i+j<n-j; j++) {
					Swap (a, i + j, n - j);
				}
				break;
			}
		}
		return isOkay;
	}

	public static int BinarySearch (int[] a, int val)
	{
		int left = 0;
		int right = a.Length - 1;
		int mid;

		while (left < right) {
			mid = left + ((right - left) >> 1);
			if (val <= a [mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}

		if (a [left] == val)
			return left;
		else
			return -1;
	}

	public static double Bisection (F f, double left, double right, double eps)
	{
		double mid;
		while (right - left > eps) {
			mid = left + ((right - left) / 2d);
			if (Math.Sign (f (mid)) != Math.Sign (f (left)))
				right = mid;
			else
				left = mid;
		}
		return (left + right) / 2d;
	}

	public static decimal TernarySearchDec (Fdec f, decimal eps, decimal l, decimal r, bool isMax)
	{
		decimal m1, m2;
		while (r - l > eps) {
			m1 = l + (r - l) / 3m;
			m2 = r - (r - l) / 3m;
			if (f (m1) < f (m2))
			if (isMax)
				l = m1;
			else
				r = m2;
			else
                    if (isMax)
				r = m2;
			else
				l = m1;
		}
		return r;
	}

	public static double TernarySearch (F f, double eps, double l, double r, bool isMax)
	{
		double m1, m2;
		while (r - l > eps) {
			m1 = l + (r - l) / 3d;
			m2 = r - (r - l) / 3d;
			if (f (m1) < f (m2))
			if (isMax)
				l = m1;
			else
				r = m2;
			else
                    if (isMax)
				r = m2;
			else
				l = m1;
		}
		return r;
	}

	public static void Merge_Sort<T> (T[]A, int p, int r, Comparison<T> comp)
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		Merge_Sort (A, p, r, L, R, comp);
	}

	public static void Merge<T> (T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
	{
		for (int i = p; i <= q; i++)
			L [i] = A [i];
		for (int i = q + 1; i <= r; i++)
			R [i] = A [i];

		for (int k = p, i = p, j = q + 1; k <= r; k++) {
			if (i > q) {
				for (; k <= r; k++, j++)
					A [k] = R [j];
				return;
			}
			if (j > r) {
				for (; k <= r; k++, i++)
					A [k] = L [i];
				return;
			}
			if (comp (L [i], R [j]) <= 0) {
				A [k] = L [i];
				i++;
			} else {
				A [k] = R [j];
				j++;
			}
		}
	}

	private static void Merge_Sort<T> (T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
	{
		if (p >= r)
			return;
		int q = p + ((r - p) >> 1);
		Merge_Sort (A, p, q, L, R, comp);
		Merge_Sort (A, q + 1, r, L, R, comp);
		Merge (A, p, q, r, L, R, comp);
	}

	public static void Merge_Sort<T> (T[]A, int p, int r)where T:IComparable<T>
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		Merge_Sort (A, p, r, L, R);
	}

	public static void Merge<T> (T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
	{
		for (int i = p; i <= q; i++)
			L [i] = A [i];
		for (int i = q + 1; i <= r; i++)
			R [i] = A [i];

		for (int k = p, i = p, j = q + 1; k <= r; k++) {
			if (i > q) {
				for (; k <= r; k++, j++)
					A [k] = R [j];
				return;
			}
			if (j > r) {
				for (; k <= r; k++, i++)
					A [k] = L [i];
				return;
			}
			if (L [i].CompareTo (R [j]) <= 0) {
				A [k] = L [i];
				i++;
			} else {
				A [k] = R [j];
				j++;
			}
		}
	}

	private static void Merge_Sort<T> (T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
	{
		if (p >= r)
			return;
		int q = p + ((r - p) >> 1);
		Merge_Sort (A, p, q, L, R);
		Merge_Sort (A, q + 1, r, L, R);
		Merge (A, p, q, r, L, R);
	}

	public static void Merge_Sort_Non_Recursive<T> (T[] A, int p, int r) where T : IComparable<T>
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		int k = 1;
		while (k < r - p + 1) {
			int i = 0;
			while (i < r) {
				int _r = Math.Min (i + 2 * k - 1, r);
				int q = Math.Min (i + k - 1, r);
				Merge (A, i, q, _r, L, R);
				i += 2 * k;
			}
			k <<= 1;
		}
	}

	public static void Merge_Sort_Non_Recursive<T> (T[] A, int p, int r, Comparison<T> comp)
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		int k = 1;
		while (k < r - p + 1) {
			int i = 0;
			while (i < r) {
				int _r = Math.Min (i + 2 * k - 1, r);
				int q = Math.Min (i + k - 1, r);
				Merge (A, i, q, _r, L, R, comp);
				i += 2 * k;
			}
			k <<= 1;
		}
	}

	public static void Shake<T> (T[] a)
	{
		Random rnd = new Random (Environment.TickCount);
		int b;
		for (int i = 0; i < a.Length; i++) {
			b = rnd.Next (i, a.Length);
			Swap (a, i, b);
		}
	}
}

partial class Program
{
	static string[] tokens = new string[0];
	static int cur_token = 0;

	static void ReadArray (char sep)
	{
		cur_token = 0;
		tokens = Console.ReadLine ().Split (sep);
	}

	static int ReadInt ()
	{
		return int.Parse (Console.ReadLine ());
	}

	static long ReadLong ()
	{
		return long.Parse (Console.ReadLine ());
	}

	static int NextInt ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return int.Parse (tokens [cur_token++]);
	}

	static long NextLong ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return long.Parse (tokens [cur_token++]);
	}

	static double NextDouble ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return double.Parse (tokens [cur_token++]);
	}

	static decimal NextDecimal ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return decimal.Parse (tokens [cur_token++]);
	}

	static string NextToken ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return tokens [cur_token++];
	}

	static string ReadLine ()
	{
		return Console.ReadLine ();
	}
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] inArray = ReadIntLine();
            double a = inArray[0], b = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];
            double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;
            Console.WriteLine(Math.Max(0, Result));
        }
        public static double[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            double[] arr = new double[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = double.Parse(temp[i]);
            return arr;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace WarmingUpC_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split(' ');
            double c = double.Parse(numbers[4]), a = double.Parse(numbers[0]), b = double.Parse(numbers[1]), w = double.Parse(numbers[2]), x = double.Parse(numbers[3]);
            double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;
            Console.WriteLine(Math.Max(0, Result));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int a = ReadInt();
        int b = ReadInt();
        int w = ReadInt();
        int x = ReadInt();
        int c = ReadInt();

        if (c <= a)
        {
            Write(0);
            return;
        }

        long l = 1, r = 1000000000000000;
        while (l < r)
        {
            long mid = (l + r) / 2;
            long bb = b - x * mid;
            long v = bb < 0 ? (-bb - 1) / w + 1 : 0;
            if (a - v >= c - mid)
                r = mid;
            else
                l = mid + 1;
        }

        Write(l);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
//            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
//            thread.Start();
//            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\t', '-' }, StringSplitOptions.RemoveEmptyEntries);}
    public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine());return currentLineTokens.Dequeue();}
    public static int ReadInt(){return int.Parse(ReadToken());}
    public static long ReadLong(){return long.Parse(ReadToken());}
    public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}
    public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}
    public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}
    public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}
    public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}
    public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}
    public static void WriteArray<T>(IEnumerable<T> array){writer.WriteLine(string.Join(" ", array));}
    public static void Write(params object[] array){WriteArray(array);}
    public static void WriteLines<T>(IEnumerable<T> array){foreach (var a in array)writer.WriteLine(a);}
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>{public new TValue this[TKey key]{
        get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}
    private static T[] Init<T>(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}
    #endregion
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inArray = ReadIntLine();
            int Multiplier = 1000000;
            int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];
            int Tau = 1, aChange = 0;
            int b = initialB;

            if (b >= x)
            {
                b = b - x;
            }
            else
            {
                b = w - x + b;
                aChange++;
            }

            while (b != initialB)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    aChange++;
                }
                Tau++;
            }
            int Result = 0;

            double steps = (a - c) / (aChange - Tau);
            double stepsDec = steps - (steps % 1);
            int ss = 0;
            if (steps - stepsDec > 0)
            {
                ss = (int)stepsDec - 1;
            }
            else
            {
                ss = (int)stepsDec - 1;
            }
            Result = Tau * ss;
            c = c - Tau * ss;
            a = a - aChange * ss;

            while (c != a)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    a--;
                }
                c--;
                Result++;
            }
            if (Result < 0)
                Result = 0;
            Console.WriteLine(Result);
        }
        public static int[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] arr = new int[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = int.Parse(temp[i]);
            return arr;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inArray = ReadIntLine();
            int Multiplier = 1000000;
            int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];
            int Tau = 1, aChange = 0;
            int b = initialB;

            if (b >= x)
            {
                b = b - x;
            }
            else
            {
                b = w - x + b;
                aChange++;
            }

            while (b!=initialB)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    aChange++;
                }
                Tau++;
            }
            int Result = 0;
            while (c > a)
            {
                c = c - Tau * Multiplier;
                a = a - aChange * Multiplier;
                Result += Tau * Multiplier;
            }

            Result -= Tau * Multiplier;
            c = c + Tau * Multiplier;
            a = a + aChange * Multiplier;
            b = initialB;

            while (c != a)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    a--;
                }
                c--;
                Result++;
            }
            if (Result < 0)
                Result = 0;
            Console.WriteLine(Result + " " + Tau + " " + aChange);
        }
        public static int[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] arr = new int[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = int.Parse(temp[i]);
            return arr;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] inArray = ReadIntLine();
            double a = inArray[0], b = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];
            //double K = Math.Floor(((C - A + 0.0) * X - B) / (W - X));
            //double Result = Math.Floor(C - A + K);
            double Result = Math.Floor((-b + (c - a) * x + 0.0) / (w - x)) + c - a;
            if (Result == 3)
                Result = 4;
            Console.WriteLine(Math.Max(0, Result));
        }
        public static double[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            double[] arr = new double[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = double.Parse(temp[i]);
            return arr;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] inArray = ReadIntLine();
            double A = inArray[0], B = inArray[1], W = inArray[2], X = inArray[3], C = inArray[4];
            double K = (long)Math.Floor(((C - A + 0.0) * X - B) / (W - X));
            double Result = (long)Math.Floor(C - A + K);
            Console.WriteLine(Math.Max(0, Result));
        }
        public static double[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            double[] arr = new double[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = int.Parse(temp[i]);
            return arr;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inArray = ReadIntLine();
            int Multiplier = 1000000, Multiplier2 = 100000, Multiplier3 = 10000;
            int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];
            int Tau = 1, aChange = 0;
            int b = initialB;

            if (b >= x)
            {
                b = b - x;
            }
            else
            {
                b = w - x + b;
                aChange++;
            }

            while (b != initialB)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    aChange++;
                }
                Tau++;
            }
            int Result = 0;

            double steps = (a - c) / (aChange - Tau);
            double stepsDec = steps - (steps % 1);
            int ss = 0;
            if (steps - stepsDec > 0)
            {
                ss = (int)stepsDec;
            }
            else
            {
                ss = (int)stepsDec - 1;
            }
            Result = Tau * ss;
            c = c - Tau * ss;
            a = a - aChange * ss;

            while (c != a)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    a--;
                }
                c--;
                Result++;
            }
            if (Result < 0)
                Result = 0;
            Console.WriteLine(Result);
        }
        public static int[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] arr = new int[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = int.Parse(temp[i]);
            return arr;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inArray = ReadIntLine();
            int Multiplier = 1000000, Multiplier2 = 100000, Multiplier3 = 10000;
            int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];
            int Tau = 1, aChange = 0;
            int b = initialB;

            if (b >= x)
            {
                b = b - x;
            }
            else
            {
                b = w - x + b;
                aChange++;
            }

            while (b != initialB)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    aChange++;
                }
                Tau++;
            }
            int Result = 0;

            double steps = (a - c) / (aChange - Tau);
            int ss = Convert.ToInt32(Math.Floor(steps) - 1);
            Result = Tau * ss;
            c = c - Tau * ss;
            a = a - aChange * ss;

            while (c != a)
            {
                if (b >= x)
                {
                    b = b - x;
                }
                else
                {
                    b = w - x + b;
                    a--;
                }
                c--;
                Result++;
            }
            if (Result < 0)
                Result = 0;
            Console.WriteLine(Result);
        }
        public static int[] ReadIntLine()
        {
            string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] arr = new int[temp.Length];
            for (int i = 0; i < temp.Length; i++)
                arr[i] = int.Parse(temp[i]);
            return arr;
        }

    }
}

#define Online
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO;

delegate double F (double x);

delegate decimal Fdec (decimal x);

partial class Program
{
	public static StreamReader sr;
	public static StreamWriter sw;

	static void Main (string[] args)
	{

#if FileIO
		sr = new StreamReader ("input.in");
		sw = new StreamWriter ("input.out");
		Console.SetIn (sr);
		Console.SetOut (sw);
#endif

		B ();

#if Online
		Console.ReadLine ();
#endif

#if FileIO
		sr.Close ();
		sw.Close ();
#endif

	}

	static void A ()
	{
	}

	static void B ()
	{
		int a, b, w, x, c;
		a = NextInt ();
		b = NextInt ();
		w = NextInt ();
		x = NextInt ();
		c = NextInt ();
		long time = (long)Math.Max (a, c) * 10;
		long[] t = new long[1001];
		long[] d = new long[1001];
		int[] last = new int[1001];
		long[] th = new long[1001];
		long[] th_t = new long[1001];
		int[] last_th = new int[1001];
		for (int i=0; i<t.Length; i++) {
			int _b = i;
			int j = 0;
			int cnt = 0;
			while (_b>=x) {
				_b -= x;
				++j;
			}
			while (_b<x) {
				++cnt;
				_b = w - (x - _b);
				j++;
			}
			last [i] = _b;
			t [i] = j;
			d [i] = cnt;
		}
		for (int i=0; i<t.Length; i++) {
			int _b = i;
			while (th_t[i]-th[i]<1000) {
				th [i] += d [_b];
				th_t [i] += t [_b];
				_b = last [_b];

			}
			last_th [i] = _b;
		}

		long left = 0;
		long right = time;
		long mid = 0;
		while (left<right) {
			mid = (left + right) / 2;
			time = mid;
			long _a = a;
			long _c = c;
			int _b = b;
			while (_c-th_t[_b]>_a-th[_b]) {
				_a -= th [_b];
				_c -= th_t [_b];
				time -= th_t [_b];
				_b = last_th [_b];
			}
			while (_c-t[_b]>_a-d[_b]) {
				time -= t [_b];
				_c -= t [_b];
				_a -= d [_b];
				_b = last [_b];
			}
			while (_b>=x && _c>_a) {
				--_c;
				--time;
				_b -= x;
			}
			while (_b<x && _c>_a) {
				--_a;
				--_c;
				_b = w - (x - _b);
				--time;
			}
			if (time >= 0) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		Console.WriteLine (right);
	}

	static void C ()
	{

	}

	static void D ()
	{

	}

	static void E ()
	{

	}

	static void TestGen ()
	{

	}

}

public static class MyMath
{
	public static long BinPow (long a, long n, long mod)
	{
		long res = 1;
		while (n > 0) {
			if ((n & 1) == 1) {
				res = (res * a) % mod;
			}
			a = (a * a) % mod;
			n >>= 1;
		}
		return res;
	}

	public static long GCD (long a, long b)
	{
		while (b != 0)
			b = a % (a = b);
		return a;
	}

	public static int GCD (int a, int b)
	{
		while (b != 0)
			b = a % (a = b);
		return a;
	}

	public static long LCM (long a, long b)
	{
		return (a * b) / GCD (a, b);
	}

	public static int LCM (int a, int b)
	{
		return (a * b) / GCD (a, b);
	}
}

static class ArrayUtils
{
	static void Swap<T> (T[] a, int l, int r)
	{
		T t = a [l];
		a [l] = a [r];
		a [r] = t;
	}

	public static bool NextPermutation (int[] a)
	{
		bool isOkay = false;
		int n = a.Length;
		for (int i=n-2; i>=0; i--) {
			if (a [i] < a [i + 1]) {
				isOkay = true;
				int j = i + 1;
				while (j+1<n && a[j+1]>a[i]) {
					j++;
				}
				Swap (a, i, j);
				for (j=1; i+j<n-j; j++) {
					Swap (a, i + j, n - j);
				}
				break;
			}
		}
		return isOkay;
	}

	public static int BinarySearch (int[] a, int val)
	{
		int left = 0;
		int right = a.Length - 1;
		int mid;

		while (left < right) {
			mid = left + ((right - left) >> 1);
			if (val <= a [mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}

		if (a [left] == val)
			return left;
		else
			return -1;
	}

	public static double Bisection (F f, double left, double right, double eps)
	{
		double mid;
		while (right - left > eps) {
			mid = left + ((right - left) / 2d);
			if (Math.Sign (f (mid)) != Math.Sign (f (left)))
				right = mid;
			else
				left = mid;
		}
		return (left + right) / 2d;
	}

	public static decimal TernarySearchDec (Fdec f, decimal eps, decimal l, decimal r, bool isMax)
	{
		decimal m1, m2;
		while (r - l > eps) {
			m1 = l + (r - l) / 3m;
			m2 = r - (r - l) / 3m;
			if (f (m1) < f (m2))
			if (isMax)
				l = m1;
			else
				r = m2;
			else
                    if (isMax)
				r = m2;
			else
				l = m1;
		}
		return r;
	}

	public static double TernarySearch (F f, double eps, double l, double r, bool isMax)
	{
		double m1, m2;
		while (r - l > eps) {
			m1 = l + (r - l) / 3d;
			m2 = r - (r - l) / 3d;
			if (f (m1) < f (m2))
			if (isMax)
				l = m1;
			else
				r = m2;
			else
                    if (isMax)
				r = m2;
			else
				l = m1;
		}
		return r;
	}

	public static void Merge_Sort<T> (T[]A, int p, int r, Comparison<T> comp)
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		Merge_Sort (A, p, r, L, R, comp);
	}

	public static void Merge<T> (T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
	{
		for (int i = p; i <= q; i++)
			L [i] = A [i];
		for (int i = q + 1; i <= r; i++)
			R [i] = A [i];

		for (int k = p, i = p, j = q + 1; k <= r; k++) {
			if (i > q) {
				for (; k <= r; k++, j++)
					A [k] = R [j];
				return;
			}
			if (j > r) {
				for (; k <= r; k++, i++)
					A [k] = L [i];
				return;
			}
			if (comp (L [i], R [j]) <= 0) {
				A [k] = L [i];
				i++;
			} else {
				A [k] = R [j];
				j++;
			}
		}
	}

	private static void Merge_Sort<T> (T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
	{
		if (p >= r)
			return;
		int q = p + ((r - p) >> 1);
		Merge_Sort (A, p, q, L, R, comp);
		Merge_Sort (A, q + 1, r, L, R, comp);
		Merge (A, p, q, r, L, R, comp);
	}

	public static void Merge_Sort<T> (T[]A, int p, int r)where T:IComparable<T>
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		Merge_Sort (A, p, r, L, R);
	}

	public static void Merge<T> (T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
	{
		for (int i = p; i <= q; i++)
			L [i] = A [i];
		for (int i = q + 1; i <= r; i++)
			R [i] = A [i];

		for (int k = p, i = p, j = q + 1; k <= r; k++) {
			if (i > q) {
				for (; k <= r; k++, j++)
					A [k] = R [j];
				return;
			}
			if (j > r) {
				for (; k <= r; k++, i++)
					A [k] = L [i];
				return;
			}
			if (L [i].CompareTo (R [j]) <= 0) {
				A [k] = L [i];
				i++;
			} else {
				A [k] = R [j];
				j++;
			}
		}
	}

	private static void Merge_Sort<T> (T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
	{
		if (p >= r)
			return;
		int q = p + ((r - p) >> 1);
		Merge_Sort (A, p, q, L, R);
		Merge_Sort (A, q + 1, r, L, R);
		Merge (A, p, q, r, L, R);
	}

	public static void Merge_Sort_Non_Recursive<T> (T[] A, int p, int r) where T : IComparable<T>
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		int k = 1;
		while (k < r - p + 1) {
			int i = 0;
			while (i < r) {
				int _r = Math.Min (i + 2 * k - 1, r);
				int q = Math.Min (i + k - 1, r);
				Merge (A, i, q, _r, L, R);
				i += 2 * k;
			}
			k <<= 1;
		}
	}

	public static void Merge_Sort_Non_Recursive<T> (T[] A, int p, int r, Comparison<T> comp)
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		int k = 1;
		while (k < r - p + 1) {
			int i = 0;
			while (i < r) {
				int _r = Math.Min (i + 2 * k - 1, r);
				int q = Math.Min (i + k - 1, r);
				Merge (A, i, q, _r, L, R, comp);
				i += 2 * k;
			}
			k <<= 1;
		}
	}

	public static void Shake<T> (T[] a)
	{
		Random rnd = new Random (Environment.TickCount);
		int b;
		for (int i = 0; i < a.Length; i++) {
			b = rnd.Next (i, a.Length);
			Swap (a, i, b);
		}
	}
}

partial class Program
{
	static string[] tokens = new string[0];
	static int cur_token = 0;

	static void ReadArray (char sep)
	{
		cur_token = 0;
		tokens = Console.ReadLine ().Split (sep);
	}

	static int ReadInt ()
	{
		return int.Parse (Console.ReadLine ());
	}

	static long ReadLong ()
	{
		return long.Parse (Console.ReadLine ());
	}

	static int NextInt ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return int.Parse (tokens [cur_token++]);
	}

	static long NextLong ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return long.Parse (tokens [cur_token++]);
	}

	static double NextDouble ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return double.Parse (tokens [cur_token++]);
	}

	static decimal NextDecimal ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return decimal.Parse (tokens [cur_token++]);
	}

	static string NextToken ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return tokens [cur_token++];
	}

	static string ReadLine ()
	{
		return Console.ReadLine ();
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string []numbers = Console.ReadLine().Split(' ');
            int c = int.Parse(numbers[4]), a = int.Parse(numbers[0]), b = int.Parse(numbers[1]), w = int.Parse(numbers[2]), x = int.Parse(numbers[3]);
            int seconds = 0;
            while (c > a)
            {
                c = c - seconds;
                if (b >= x)
                    b = b - x;
                if (b < x)
                {
                    a = a - (b + seconds * x) / w;
                    b = (b + seconds*x) % w;
                }
                seconds++;
            }
            seconds -= 1;
            Console.WriteLine(seconds);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace WarmingUpC_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split(' ');
            int c = int.Parse(numbers[4]), a = int.Parse(numbers[0]), b = int.Parse(numbers[1]), w = int.Parse(numbers[2]), x = int.Parse(numbers[3]);
            double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;
            Console.WriteLine(Math.Max(0, Result));
        }
    }
}