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.

Input

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).

Output

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.

Examples

Input

4 2 3 1 6


Output

2


Input

4 2 3 1 7


Output

4


Input

1 2 3 2 6


Output

13


Input

1 1 2 1 1


Output

0

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;
    }
}
