//package CodeforcesProject;

import java.io.*;
import java.lang.*;
import java.util.*;
import java.util.function.BiFunction;

public class Main extends IO {

    public static void main(String[] args) throws Exception {
        int g = readInt();
        int sh = readInt();
        int j = readInt();
        int p = readInt();
        int priceFirst = readInt();
        int priceSecond = readInt();
        long answer = 0;
        if (priceFirst <= priceSecond){
            answer = Math.min(Math.min(sh, j), p);
            p -= answer;
            answer *= priceSecond;
            answer += (Math.min(p, g) * priceFirst);
        }
        else{
            answer = Math.min(g, p);
            p -= answer;
            answer *= priceFirst;
            answer += (Math.min(Math.min(sh, j), p) * priceSecond);
        }
        System.out.println(answer);
    }
}

class math {

    protected static int remains = 0x989687;

    protected static int gcd(int a, int b) { // NOD
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

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

    protected static float gcd(float a, float b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    protected static double gcd(double a, double b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    protected static double lcm(double a, double b) { // NOK
        return a / gcd(a, b) * b;
    }

    protected static float lcm(float a, float b) { // NOK
        return a / gcd(a, b) * b;
    }

    protected static int lcm(int a, int b) { // NOK
        return a / gcd(a, b) * b;
    }

    protected static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    protected static double log(double value, int base) {
        return Math.log(value) / Math.log(base);
    }

    protected static long factorial(int number) {
        if (number < 0) {
            return 0;
        }
        return solveFactorial(number);
    }

    private static long solveFactorial(int number) {
        if (number > 0) {
            return solveFactorial(number - 1) * number;
        }
        return 1;
    }
}

class Int implements Comparable<Integer> {

    protected int value;

    Int(int value) {
        this.value = value;
    }

    @Override
    public int compareTo(Integer o) {
        return (this.value < o) ? -1 : ((this.value == o) ? 0 : 1);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Integer) {
            return value == (Integer) obj;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return value;
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }
}

class Fraction<T extends Number> extends Pair {

    private Fraction(T dividend, T divider) {
        super(dividend, divider);
        reduce();
    }

    protected static <T extends Number> Fraction<T> createFraction(T dividend, T divider) {
        return new Fraction<>(dividend, divider);
    }

    protected void reduce() {
        if (getFirstElement() instanceof Integer) {
            Integer Dividend = (Integer) getFirstElement();
            Integer Divider = (Integer) getSecondElement();
            int gcd = math.gcd(Dividend, Divider);
            setFirst(Dividend / gcd);
            setSecond(Divider / gcd);
        } else if (getFirstElement() instanceof Long) {
            Long Dividend = (Long) getFirstElement();
            Long Divider = (Long) getSecondElement();
            long gcd = math.gcd(Dividend, Divider);
            setFirst(Dividend / gcd);
            setSecond(Divider / gcd);
        } else if (getFirstElement() instanceof Float) {
            Float Dividend = (Float) getFirstElement();
            Float Divider = (Float) getSecondElement();
            float gcd = math.gcd(Dividend, Divider);
            setFirst(Dividend / gcd);
            setSecond(Divider / gcd);
        } else if (getFirstElement() instanceof Double) {
            Double Dividend = (Double) getFirstElement();
            Double Divider = (Double) getSecondElement();
            double gcd = math.gcd(Dividend, Divider);
            setFirst(Dividend / gcd);
            setSecond(Divider / gcd);
        }
    }

    protected void addWithoutReturn(Fraction number) throws UnsupportedOperationException {
        add(number, 0);
    }

    private Fraction add(Fraction number, int function) throws UnsupportedOperationException {
        if (getFirstElement() instanceof Integer && number.getFirstElement() instanceof Integer) {
            Integer Dividend = (Integer) getFirstElement();
            Integer Divider = (Integer) getSecondElement();
            Integer Dividend1 = (Integer) number.getFirstElement();
            Integer Divider1 = (Integer) number.getSecondElement();
            Integer lcm = math.lcm(Divider, Divider1);
            if (function == 0) {
                setFirst((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1);
                setSecond(lcm);
                reduce();
                return null;
            }
            Fraction result = Fraction.createFraction((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1, lcm);
            result.reduce();
            return result;

        } else if (getFirstElement() instanceof Long && number.getFirstElement() instanceof Long) {
            Long Dividend = (Long) getFirstElement();
            Long Divider = (Long) getSecondElement();
            Long Dividend1 = (Long) number.getFirstElement();
            Long Divider1 = (Long) number.getSecondElement();
            Long lcm = math.lcm(Divider, Divider1);
            if (function == 0) {
                setFirst((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1);
                setSecond(lcm);
                reduce();
                return null;
            }
            Fraction result = Fraction.createFraction((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1, lcm);
            result.reduce();
            return result;
        } else if (getFirstElement() instanceof Float && number.getFirstElement() instanceof Float) {
            Float Dividend = (Float) getFirstElement();
            Float Divider = (Float) getSecondElement();
            Float Dividend1 = (Float) number.getFirstElement();
            Float Divider1 = (Float) number.getSecondElement();
            Float lcm = math.lcm(Divider, Divider1);
            if (function == 0) {
                setFirst((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1);
                setSecond(lcm);
                reduce();
                return null;
            }
            Fraction result = Fraction.createFraction((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1, lcm);
            result.reduce();
            return result;
        } else if (getFirstElement() instanceof Double && number.getFirstElement() instanceof Double) {
            Double Dividend = (Double) getFirstElement();
            Double Divider = (Double) getSecondElement();
            Double Dividend1 = (Double) number.getFirstElement();
            Double Divider1 = (Double) number.getSecondElement();
            Double lcm = math.lcm(Divider, Divider1);
            if (function == 0) {
                setFirst((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1);
                setSecond(lcm);
                reduce();
                return null;
            }
            Fraction result = Fraction.createFraction((lcm / Divider) * Dividend + (lcm / Divider1) * Dividend1, lcm);
            result.reduce();
            return result;
        } else {
            throw new UnsupportedOperationException();
        }
    }

    protected Fraction addWithReturn(Fraction number) {
        return add(number, 1);
    }

    protected void multiplyWithoutReturn(Fraction number) throws UnsupportedOperationException {
        multiply(number, 0);
    }

    protected Fraction multiplyWithReturn(Fraction number) throws UnsupportedOperationException {
        return multiply(number, 1);
    }

    private Fraction multiply(Fraction number, int function) throws UnsupportedOperationException {
        if (getFirstElement() instanceof Integer && number.getFirstElement() instanceof Integer) {
            Integer first = (Integer) getFirstElement() * (Integer) number.getFirstElement();
            Integer second = (Integer) getSecondElement() * (Integer) number.getSecondElement();
            if (function == 0) {
                setFirst(first);
                setSecond(second);
                reduce();
                return null;
            }
            Fraction answer = Fraction.createFraction(first, second);
            answer.reduce();
            return answer;
        } else if (getFirstElement() instanceof Long && number.getFirstElement() instanceof Long) {
            Long first = (Long) getFirstElement() * (Long) number.getFirstElement();
            Long second = (Long) getSecondElement() * (Long) number.getSecondElement();
            if (function == 0) {
                setFirst(first);
                setSecond(second);
                reduce();
                return null;
            }
            Fraction answer = Fraction.createFraction(first, second);
            answer.reduce();
            return answer;

        } else if (getFirstElement() instanceof Float && number.getFirstElement() instanceof Float) {
            Float first = (Float) getFirstElement() * (Float) number.getFirstElement();
            Float second = (Float) getSecondElement() * (Float) number.getSecondElement();
            if (function == 0) {
                setFirst(first);
                setSecond(second);
                reduce();
                return null;
            }
            Fraction answer = Fraction.createFraction(first, second);
            answer.reduce();
            return answer;
        } else if (getFirstElement() instanceof Double && number.getFirstElement() instanceof Double) {
            Double first = (Double) getFirstElement() * (Double) number.getFirstElement();
            Double second = (Double) getSecondElement() * (Double) number.getSecondElement();
            if (function == 0) {
                setFirst(first);
                setSecond(second);
                reduce();
                return null;
            }
            Fraction answer = Fraction.createFraction(first, second);
            answer.reduce();
            return answer;
        } else {
            throw new UnsupportedOperationException();
        }
    }
}

class Pair<T, T1> implements Cloneable {

    private T first;
    private T1 second;

    Pair(T obj, T1 obj1) {
        first = obj;
        second = obj1;
    }

    protected static <T, T1> Pair<T, T1> createPair(T element, T1 element1) {
        return new Pair<>(element, element1);
    }

    protected T getFirstElement() {
        return first;
    }

    protected T1 getSecondElement() {
        return second;
    }

    protected void setFirst(T element) {
        first = element;
    }

    protected void setSecond(T1 element) {
        second = element;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Pair)) {
            return false;
        }
        Pair pair = (Pair) obj;
        return first.equals(pair.first) && second.equals(pair.second);
    }

    @Override
    public int hashCode() {
        int hashCode = 1;
        hashCode = 31 * hashCode + (first == null ? 0 : first.hashCode());
        return 31 * hashCode + (second == null ? 0 : second.hashCode());
    }

    @Override
    public Object clone() {
        return Pair.createPair(first, second);
    }
}

class Graph {

    private int[][] base;
    private boolean[] used;
    private int quantity;
    private Integer[] ancestor;

    public int[][] getBase() {
        return base.clone();
    }

    public boolean[] getUsed() {
        return used.clone();
    }

    public int getQuantity() {
        return quantity;
    }

    public Integer[] getAncestor() {
        return ancestor.clone();
    }

    public void setBase(int[][] base) {
        this.base = base;
    }

    protected void start(int length) {
        used = new boolean[length];
        ancestor = new Integer[length];
        Arrays.fill(ancestor, -1);
        quantity = 0;
    }

    protected void edgesMatrixToDefault(int length, int quantity, boolean readConsole, int[][] value) throws Exception {
        base = new int[length][];
        List<ArrayList<Integer>> inputBase = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            inputBase.add(new ArrayList<>());
        }
        for (int i = 0; i < quantity; i++) {
            int[] input = readConsole ? IO.readArrayInt(" ") : value[i];
            inputBase.get(input[0] - 1).add(input[1] - 1);
            //inputBase.get(input[0] - 1).add(input[2]); // price
            inputBase.get(input[1] - 1).add(input[0] - 1);
            //inputBase.get(input[1] - 1).add(input[2]); // price
        }
        for (int i = 0; i < length; i++) {
            base[i] = inputBase.get(i).stream().mapToInt(Integer::intValue).toArray();
        }
        start(length);
    }

    protected void adjacencyMatrixToDefault(int length, int not, boolean readConsole, int[][] value) throws Exception {
        this.base = new int[length][];
        List<Integer> buffer = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            int[] InputArray = readConsole ? IO.readArrayInt(" ") : value[i];
            for (int index = 0; index < length; index++) {
                if (i != index && InputArray[index] != not) {
                    buffer.add(index);
                    // buffer.add(InputArray[index]); // price
                }
            }
            this.base[i] = buffer.stream().mapToInt(Integer::intValue).toArray();
            buffer.clear();
        }
        start(length);
    }

    protected void dfs(int position) throws Exception {
        used[position] = true;
        quantity++;
        int next;
        for (int index = 0; index < base[position].length; index++) {
            next = base[position][index];
            if (!used[next]) {
                ancestor[next] = position;
                dfs(next);
            } /*else {
                if (next != ancestor[position]) { // if cycle
                    throw new Exception();
                }
            }*/
        }
    }

    protected int dijkstra(int start, int stop, int size) {
        start--;
        stop--;
        int[] dist = new int[size];
        for (int i = 0; i < size; i++) {
            if (i != start) {
                dist[i] = Integer.MAX_VALUE;
            }
            ancestor[i] = start;
        }

        Queue<int[]> queue = new PriorityQueue<>(Comparator.comparingInt((int[] ints) -> ints[1]));
        queue.add(new int[]{start, 0});
        int position;
        int[] getQueue;
        while (queue.size() != 0) {
            getQueue = queue.poll();
            position = getQueue[0];
            if (getQueue[1] > dist[position]) {
                continue;
            }
            for (int index = 0; index < this.base[position].length; index += 2) {
                if (dist[position] + this.base[position][index + 1] < dist[this.base[position][index]] && !this.used[this.base[position][index]]) {
                    dist[this.base[position][index]] = dist[position] + this.base[position][index + 1];
                    this.ancestor[this.base[position][index]] = position;
                    queue.add(new int[]{this.base[position][index], dist[this.base[position][index]]});
                }
            }
            used[position] = true;
        }
        return dist[stop] == Integer.MAX_VALUE ? -1 : dist[stop];
    }

    protected static boolean solveFloydWarshall(int[][] base, int length, int not) {
        for (int k = 0; k < length; k++) {
            for (int i = 0; i < length; i++) {
                for (int j = 0; j < length; j++) {
                    if (base[i][k] == not || base[k][j] == not) {
                        continue;
                    }
                    int total = base[i][k] + base[k][j];
                    if (base[i][j] != not) {
                        base[i][j] = Math.min(base[i][j], total);
                    } else {
                        base[i][j] = total;
                    }
                }
            }
        }
        for (int index = 0; index < length; index++) {
            if (base[index][index] != 0) { // if cycle
                return false;
            }
        }
        return true;
    }

    protected static Pair<Long, int[][]> solveKruskal(int[][] edgesMatrix, final int countVertex, final int indexSort) {
        int[][] answer = new int[countVertex - 1][2];
        long sum = 0;
        Arrays.sort(edgesMatrix, Comparator.comparingInt(value -> value[indexSort]));
        SystemOfDisjointSets dsu = new SystemOfDisjointSets(countVertex);
        for (int i = 0; i < countVertex; i++) {
            dsu.makeSet(i);
        }
        int index = 0;
        for (int[] value : edgesMatrix) {
            if (dsu.mergeSets(value[0], value[1])) {
                sum += value[indexSort];
                answer[index] = new int[]{value[0], value[1]};
                index++;
            }
        }
        if (index < countVertex - 1) {
            return Pair.createPair(null, null);
        }
        return Pair.createPair(sum, answer);
    }

    static class SegmentTree {

        private int[] segmentArray;
        private BiFunction<Integer, Integer, Integer> function;

        protected void setSegmentArray(int[] segmentArray) {
            this.segmentArray = segmentArray;
        }

        protected int[] getSegmentArray() {
            return segmentArray.clone();
        }

        protected void setFunction(BiFunction<Integer, Integer, Integer> function) {
            this.function = function;
        }

        protected BiFunction<Integer, Integer, Integer> getFunction() {
            return function;
        }

        SegmentTree() {

        }

        SegmentTree(int[] startBase, int neutral, BiFunction<Integer, Integer, Integer> function) {
            this.function = function;
            int length = startBase.length;
            int[] base;
            if ((length & (length - 1)) != 0) {
                int pow = 0;
                while (length > 0) {
                    length >>= 1;
                    pow++;
                }
                pow--;
                base = new int[2 << pow];
                System.arraycopy(startBase, 0, base, 0, startBase.length);
                Arrays.fill(base, startBase.length, base.length, neutral);

            } else {
                base = startBase;
            }
            segmentArray = new int[base.length << 1]; // maybe * 4
            Arrays.fill(segmentArray, neutral);
            inDepth(base, 1, 0, base.length - 1);
        }

        private void inDepth(int[] base, int position, int low, int high) {
            if (low == high) {
                segmentArray[position] = base[low];
            } else {
                int mid = (low + high) >> 1;
                inDepth(base, position << 1, low, mid);
                inDepth(base, (position << 1) + 1, mid + 1, high);
                segmentArray[position] = function.apply(segmentArray[position << 1], segmentArray[(position << 1) + 1]);
            }
        }

        protected int getValue(int left, int right, int neutral) {
            return findValue(1, 0, ((segmentArray.length) >> 1) - 1, left, right, neutral);
        }

        private int findValue(int position, int low, int high, int left, int right, int neutral) {
            if (left > right) {
                return neutral;
            }
            if (left == low && right == high) {
                return segmentArray[position];
            }
            int mid = (low + high) >> 1;
            return function.apply(findValue(position << 1, low, mid, left, Math.min(right, mid), neutral),
                    findValue((position << 1) + 1, mid + 1, high, Math.max(left, mid + 1), right, neutral));
        }

        protected void replaceValue(int index, int value) {
            update(1, 0, (segmentArray.length >> 1) - 1, index, value);
        }

        private void update(int position, int low, int high, int index, int value) {
            if (low == high) {
                segmentArray[position] = value;
            } else {
                int mid = (low + high) >> 1;
                if (index <= mid) {
                    update(position << 1, low, mid, index, value);
                } else {
                    update((position << 1) + 1, mid + 1, high, index, value);
                }
                segmentArray[position] = function.apply(segmentArray[position << 1], segmentArray[(position << 1) + 1]);
            }
        }
    }

    static class SegmentTreeGeneric<T> {

        private Object[] segmentArray;
        private BiFunction<T, T, T> function;

        protected void setSegmentArray(T[] segmentArray) {
            this.segmentArray = segmentArray;
        }

        protected Object getSegmentArray() {
            return segmentArray.clone();
        }

        protected void setFunction(BiFunction<T, T, T> function) {
            this.function = function;
        }

        protected BiFunction<T, T, T> getFunction() {
            return function;
        }

        SegmentTreeGeneric() {

        }

        SegmentTreeGeneric(T[] startBase, T neutral, BiFunction<T, T, T> function) {
            this.function = function;
            int length = startBase.length;
            Object[] base;
            if ((length & (length - 1)) != 0) {
                int pow = 0;
                while (length > 0) {
                    length >>= 1;
                    pow++;
                }
                pow--;
                base = new Object[2 << pow];
                System.arraycopy(startBase, 0, base, 0, startBase.length);
                Arrays.fill(base, startBase.length, base.length, neutral);

            } else {
                base = startBase;
            }
            segmentArray = new Object[base.length << 1]; // maybe * 4
            Arrays.fill(segmentArray, neutral);
            inDepth(base, 1, 0, base.length - 1);
        }

        private void inDepth(Object[] base, int position, int low, int high) {
            if (low == high) {
                segmentArray[position] = base[low];
            } else {
                int mid = (low + high) >> 1;
                inDepth(base, position << 1, low, mid);
                inDepth(base, (position << 1) + 1, mid + 1, high);
                segmentArray[position] = function.apply((T) segmentArray[position << 1], (T) segmentArray[(position << 1) + 1]);
            }
        }

        protected T getValue(int left, int right, T neutral) {
            return findValue(1, 0, ((segmentArray.length) >> 1) - 1, left, right, neutral);
        }

        private T findValue(int position, int low, int high, int left, int right, T neutral) {
            if (left > right) {
                return neutral;
            }
            if (left == low && right == high) {
                return (T) segmentArray[position];
            }
            int mid = (low + high) >> 1;
            return function.apply(findValue(position << 1, low, mid, left, Math.min(right, mid), neutral),
                    findValue((position << 1) + 1, mid + 1, high, Math.max(left, mid + 1), right, neutral));
        }

        protected void replaceValue(int index, T value) {
            update(1, 0, (segmentArray.length >> 1) - 1, index, value);
        }

        private void update(int position, int low, int high, int index, T value) {
            if (low == high) {
                segmentArray[position] = value;
            } else {
                int mid = (low + high) >> 1;
                if (index <= mid) {
                    update(position << 1, low, mid, index, value);
                } else {
                    update((position << 1) + 1, mid + 1, high, index, value);
                }
                segmentArray[position] = function.apply((T) segmentArray[position << 1], (T) segmentArray[(position << 1) + 1]);
            }
        }
    }
}

class SystemOfDisjointSets {

    private int[] rank;
    private int[] ancestor;

    SystemOfDisjointSets(int size) {
        this.rank = new int[size];
        this.ancestor = new int[size];
    }

    protected void makeSet(int value) {
        ancestor[value] = value;
        rank[value] = 0;
    }

    protected int findSet(int value) {
        if (value == ancestor[value]) {
            return value;
        }
        return ancestor[value] = findSet(ancestor[value]);
    }

    protected boolean mergeSets(int first, int second) {
        first = findSet(first);
        second = findSet(second);
        if (first != second) {
            if (rank[first] < rank[second]) {
                int number = first;
                first = second;
                second = number;
            }
            ancestor[second] = first;
            if (rank[first] == rank[second]) {
                rank[first]++;
            }
            return true;
        }
        return false;
    }
}

interface Array {
    void useArray(int[] a);
}

interface Method {
    void use();
}

class FastSort {

    protected static int[] sort(int[] array, int ShellHeapMergeMyInsertionSort) {
        sort(array, ShellHeapMergeMyInsertionSort, array.length);
        return array;
    }

    protected static int[] sortClone(int[] array, int ShellHeapMergeMyInsertionSort) {
        int[] base = array.clone();
        sort(base, ShellHeapMergeMyInsertionSort, array.length);
        return base;
    }

    private static void sort(int[] array, int ShellHeapMergeMyInsertionSort, int length) {
        if (ShellHeapMergeMyInsertionSort < 0 || ShellHeapMergeMyInsertionSort > 4) {
            Random random = new Random();
            ShellHeapMergeMyInsertionSort = random.nextInt(4);
        }
        if (ShellHeapMergeMyInsertionSort == 0) {
            ShellSort(array);
        } else if (ShellHeapMergeMyInsertionSort == 1) {
            HeapSort(array);
        } else if (ShellHeapMergeMyInsertionSort == 2) {
            MergeSort(array, 0, length - 1);
        } else if (ShellHeapMergeMyInsertionSort == 3) {
            straightMergeSort(array, length);
        } else if (ShellHeapMergeMyInsertionSort == 4) {
            insertionSort(array);
        }
    }

    private static void straightMergeSort(int[] array, int size) {
        if (size == 0) {
            return;
        }
        int length = (size >> 1) + ((size % 2) == 0 ? 0 : 1);
        Integer[][] ZeroBuffer = new Integer[length + length % 2][2];
        Integer[][] FirstBuffer = new Integer[0][0];
        for (int index = 0; index < length; index++) {
            int ArrayIndex = index << 1;
            int NextArrayIndex = (index << 1) + 1;
            if (NextArrayIndex < size) {
                if (array[ArrayIndex] > array[NextArrayIndex]) {
                    ZeroBuffer[index][0] = array[NextArrayIndex];
                    ZeroBuffer[index][1] = array[ArrayIndex];
                } else {
                    ZeroBuffer[index][0] = array[ArrayIndex];
                    ZeroBuffer[index][1] = array[NextArrayIndex];
                }
            } else {
                ZeroBuffer[index][0] = array[ArrayIndex];
            }
        }
        boolean position = false;
        int pointer0, pointer, pointer1, number = 4, NewPointer, count;
        Integer[][] NewBuffer;
        Integer[][] OldBuffer;
        length = (size >> 2) + ((size % 4) == 0 ? 0 : 1);
        while (true) {
            pointer0 = 0;
            count = (number >> 1) - 1;
            if (!position) {
                FirstBuffer = new Integer[length + length % 2][number];
                NewBuffer = FirstBuffer;
                OldBuffer = ZeroBuffer;
            } else {
                ZeroBuffer = new Integer[length + length % 2][number];
                NewBuffer = ZeroBuffer;
                OldBuffer = FirstBuffer;
            }
            for (int i = 0; i < length; i++) {
                pointer = 0;
                pointer1 = 0;
                NewPointer = pointer0 + 1;
                if (length == 1) {
                    for (int g = 0; g < size; g++) {
                        if (pointer > count || OldBuffer[pointer0][pointer] == null) {
                            array[g] = OldBuffer[NewPointer][pointer1];
                            pointer1++;
                        } else if (pointer1 > count || OldBuffer[NewPointer][pointer1] == null) {
                            if (OldBuffer[pointer0][pointer] == null) {
                                continue;
                            }
                            array[g] = OldBuffer[pointer0][pointer];
                            pointer++;
                        } else if (OldBuffer[pointer0][pointer] >= OldBuffer[NewPointer][pointer1]) {
                            array[g] = OldBuffer[NewPointer][pointer1];
                            pointer1++;
                        } else {
                            array[g] = OldBuffer[pointer0][pointer];
                            pointer++;
                        }
                    }
                    return;
                }
                for (int g = 0; g < number; g++) {
                    if (pointer > count || OldBuffer[pointer0][pointer] == null) {
                        if (OldBuffer[NewPointer][pointer1] == null) {
                            continue;
                        }
                        NewBuffer[i][g] = OldBuffer[NewPointer][pointer1];
                        pointer1++;
                    } else if (pointer1 > count || OldBuffer[NewPointer][pointer1] == null) {
                        if (OldBuffer[pointer0][pointer] == null) {
                            continue;
                        }
                        NewBuffer[i][g] = OldBuffer[pointer0][pointer];
                        pointer++;
                    } else if (OldBuffer[pointer0][pointer] >= OldBuffer[NewPointer][pointer1]) {
                        NewBuffer[i][g] = OldBuffer[NewPointer][pointer1];
                        pointer1++;
                    } else {
                        NewBuffer[i][g] = OldBuffer[pointer0][pointer];
                        pointer++;
                    }
                }
                pointer0 += 2;
            }
            position = !position;
            length = (length >> 1) + length % 2;
            number <<= 1;
        }
    }

    private static void ShellSort(int[] array) {
        int j;
        for (int gap = (array.length >> 1); gap > 0; gap >>= 1) {
            for (int i = gap; i < array.length; i++) {
                int temp = array[i];
                for (j = i; j >= gap && array[j - gap] > temp; j -= gap) {
                    array[j] = array[j - gap];
                }
                array[j] = temp;
            }
        }
    }

    private static void HeapSort(int[] array) {
        for (int i = (array.length >> 1) - 1; i >= 0; i--)
            shiftDown(array, i, array.length);
        for (int i = array.length - 1; i > 0; i--) {
            swap(array, 0, i);
            shiftDown(array, 0, i);
        }
    }

    private static void shiftDown(int[] array, int i, int n) {
        int child;
        int tmp;
        for (tmp = array[i]; leftChild(i) < n; i = child) {
            child = leftChild(i);
            if (child != n - 1 && (array[child] < array[child + 1]))
                child++;
            if (tmp < array[child])
                array[i] = array[child];
            else
                break;
        }
        array[i] = tmp;
    }

    private static int leftChild(int i) {
        return (i << 1) + 1;
    }

    private static void swap(int[] array, int i, int j) {
        int temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }

    private static void MergeSort(int[] array, int low, int high) {
        if (low < high) {
            int mid = (low + high) >> 1;
            MergeSort(array, low, mid);
            MergeSort(array, mid + 1, high);
            merge(array, low, mid, high);
        }
    }

    private static void merge(int[] array, int low, int mid, int high) {
        int n = high - low + 1;
        int[] Temp = new int[n];
        int i = low, j = mid + 1;
        int k = 0;
        while (i <= mid || j <= high) {
            if (i > mid)
                Temp[k++] = array[j++];
            else if (j > high)
                Temp[k++] = array[i++];
            else if (array[i] < array[j])
                Temp[k++] = array[i++];
            else
                Temp[k++] = array[j++];
        }
        for (j = 0; j < n; j++)
            array[low + j] = Temp[j];
    }

    private static void insertionSort(int[] elements) {
        for (int i = 1; i < elements.length; i++) {
            int key = elements[i];
            int j = i - 1;
            while (j >= 0 && key < elements[j]) {
                elements[j + 1] = elements[j];
                j--;
            }
            elements[j + 1] = key;
        }
    }
}

class IO {

    private static BufferedReader read;
    private static boolean fileInput = false;
    private static BufferedWriter write;
    private static boolean fileOutput = false;

    public static void setFileInput(boolean fileInput) {
        IO.fileInput = fileInput;
    }

    public static void setFileOutput(boolean fileOutput) {
        IO.fileOutput = fileOutput;
    }

    private static void startInput() {
        try {
            read = new BufferedReader(fileInput ? new FileReader("input.txt") : new InputStreamReader(System.in));
        } catch (Exception error) {
        }
    }

    private static void startOutput() {
        try {
            write = new BufferedWriter(fileOutput ? new FileWriter("output.txt") : new OutputStreamWriter(System.out));
        } catch (Exception error) {
        }
    }

    protected static int readInt() throws Exception {
        if (read == null) {
            startInput();
        }
        return Integer.parseInt(read.readLine());
    }

    protected static long readLong() throws Exception {
        if (read == null) {
            startInput();
        }
        return Long.parseLong(read.readLine());
    }

    protected static String readString() throws Exception {
        if (read == null) {
            startInput();
        }
        return read.readLine();
    }

    protected static int[] readArrayInt(String split) throws Exception {
        if (read == null) {
            startInput();
        }
        return Arrays.stream(read.readLine().split(split)).mapToInt(Integer::parseInt).toArray();
    }

    protected static long[] readArrayLong(String split) throws Exception {
        if (read == null) {
            startInput();
        }
        return Arrays.stream(read.readLine().split(split)).mapToLong(Long::parseLong).toArray();
    }

    protected static String[] readArrayString(String split) throws Exception {
        if (read == null) {
            startInput();
        }
        return read.readLine().split(split);
    }

    protected static void writeArray(int[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(Integer.toString(array[index]));
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception error) {
        }
    }

    protected static void writeArray(Integer[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(Integer.toString(array[index]));
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception error) {
        }
    }

    protected static void writeArray(Int[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(Integer.toString(array[index].value));
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception error) {
        }
    }

    protected static void writeArray(long[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(Long.toString(array[index]));
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception error) {
        }
    }

    protected static void writeArray(Long[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(Long.toString(array[index]));
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception error) {
        }
    }

    public static void writeArray(String[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(array[index]);
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception ignored) {
        }
    }

    protected static void writeArray(boolean[] array, String split, boolean enter) {
        if (write == null) {
            startOutput();
        }
        try {
            int length = array.length;
            for (int index = 0; index < length; index++) {
                write.write(Boolean.toString(array[index]));
                if (index + 1 != length) {
                    write.write(split);
                }
            }
            if (enter) {
                writeEnter();
            }
        } catch (Exception ignored) {
        }
    }

    protected static void writeInt(int number, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(Integer.toString(number));
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeInt(Integer number, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(Integer.toString(number));
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeLong(long number, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(Long.toString(number));
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeLong(Long number, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(Long.toString(number));
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeString(String word, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(word);
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeBoolean(boolean value, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(value ? "true" : "false");
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeBoolean(Boolean value, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(value ? "true" : "false");
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeChar(char word, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(word);
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeChar(Character word, String end) {
        if (write == null) {
            startOutput();
        }
        try {
            write.write(word);
            write.write(end);
        } catch (Exception ignored) {
        }
    }

    protected static void writeEnter() {
        if (write == null) {
            startOutput();
        }
        try {
            write.newLine();
        } catch (Exception ignored) {
        }
    }

    protected static void print(boolean exit) throws Exception {
        if (exit) {
            print();
        } else {
            write.flush();
        }
    }

    protected static void print() throws Exception {
        if (write == null) {
            return;
        }
        write.flush();
        if (read != null) {
            read.close();
        }
        write.close();
    }
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author yousuf
 */
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int n = in.nextInt();
            int k = in.nextInt();

            long b = 1;
            for (int i = 1; i <= k; i++) {
                b *= 10;
            }

            out.println(IntegerUtils.lcm(n, b));

        }

    }

    static class IntegerUtils {
        public static long gcd(long a, long b) {
            long t;
            while (b != 0) {
                t = b;
                b = a % b;
                a = t;
            }

            return a;
        }

        public static long lcm(long a, long b) {
            return a * (b / gcd(a, b));
        }

    }

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

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            //  reader = new BufferedReader(new FileReader("input.txt"));
            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.util.Scanner;
import java.util.HashSet;

public class Main {

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String w = s.nextLine().trim().toLowerCase();
    StringBuffer sb = new StringBuffer();
    HashSet<Character> vowels = new HashSet<Character>();
    vowels.add('a');
    vowels.add('e');
    vowels.add('i');
    vowels.add('o');
    vowels.add('u');
    vowels.add('y');
    for (char c : w.toCharArray()) {
      if (vowels.contains(c)) continue;
      sb.append('.');
      sb.append(c);
    }
    System.out.println(sb.toString());
  }
}


import java.util.*;

public class Main{

  public static void main(String[] args){
    Scanner in=new Scanner(System.in);
    int n,m,k,x,y,z;
    n=in.nextInt();
    m=in.nextInt();
    k=in.nextInt();
    x=k/2+k%2;
    y=x/m + ((x%m==0)?0:1);
    z=(x%m==0)?m:x%m;
    System.out.println(y +" "+ z +" "+((k%2==0)?"R":"L"));

  }
}


import java.util.Scanner;

public class LearnJava{

    public static void main(String[] args){
        int n, count=0;
        double k;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        for(int i=1; i<=n; i++){
            for(int j=i; j<=n; j++){
                k = Math.sqrt(i*i + j*j);
                if(k==(int)k && k<=n)
                    count++;
            }
        }
        System.out.print(count);
    }
}


//package codeforces;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StreamTokenizer;
import java.util.ArrayList;

public class CodeForces {

    ArrayList<Integer> num = new ArrayList<Integer>();

    private boolean search(int value, int begin, int end) {
        if (end - begin < 3) {
            if (num.get(begin) == value || num.get(end) == value) {
                return (true);
            } else {
                return (false);
            }
        } else {
            int middle = (end - begin) / 2 + begin;
            if (num.get(middle) == value) {
                return (true);
            } else {
                if (num.get(middle) < value) {
                    return (search(value, middle + 1, end));
                } else {
                    return (search(value, begin, middle - 1));
                }
            }
        }
    }

    public void run() throws IOException {
        MyScanner sc = new MyScanner(System.in);
        int n = sc.nextInt();
        int i = 1;
        boolean greater = false;
        while (!greater) {
            long number = i * (i + 1) / 2;
            if (number >= n) {
                greater = true;
            } else {
                num.add((int) number);
            }
            i++;
        }
        boolean exist = false;
        for (i = 0; i < num.size(); i++) {
            if (search(n - num.get(i), 0, num.size() - 1)) {
                exist = true;
                break;
            }
        }
        if (exist) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    public static void main(String[] args) throws FileNotFoundException, IOException {
        CodeForces cf = new CodeForces();
        cf.run();
    }
}

class MyScanner {

    private StreamTokenizer st;

    public MyScanner(InputStream is) {
        st = new StreamTokenizer(is);
    }

    public MyScanner(File f) throws FileNotFoundException {
        BufferedReader in = new BufferedReader(new FileReader(f));
        st = new StreamTokenizer(in);
    }

    public int nextInt() throws IOException {
        st.nextToken();
        return ((int) st.nval);
    }

    public double nextDouble() throws IOException {
        st.nextToken();
        return (st.nval);
    }

    public String nextString() throws IOException {
        st.nextToken();
        return (st.sval);
    }
}


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

public class B {

	public static void main(String[] args) throws IOException{
		FastScanner sc = new FastScanner();
//		int yo = sc.nextInt();
//		while(yo-->0) {
//		}

		int n = sc.nextInt();
		int m = sc.nextInt();

		char[][] arr = new char[n][m];
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			for(int j = 0; j < m; j++) {
				arr[i][j] = s.charAt(j);
			}
		}

		int count = 0;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				if(arr[i][j] == 'W') {
					count += helper(arr,i,j);
				}
			}
		}
		System.out.println(count);
	}

	private static int  helper(char[][] arr, int i, int j) {
		int row = arr.length;
		int col = arr[0].length;

		int count = 0;

		if(i-1 >= 0 && arr[i-1][j] == 'P') {
			arr[i-1][j] = '.';
			count++;
			return count;
		}

		if(j-1 >= 0 && arr[i][j-1] == 'P') {
			arr[i][j-1] = '.';
			count++;
			return count;
		}

		if(i+1 < row && arr[i+1][j] == 'P') {
			arr[i+1][j] = '.';
			count++;
			return count;
		}

		if(j+1 < col && arr[i][j+1] == 'P') {
			arr[i][j+1] = '.';
			count++;
		}

		return count;
	}

	static int mod = 1000000007;

	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

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

	static boolean[] sieve(int n) {

		boolean isPrime[] = new boolean[n+1];
		for(int i = 2; i <= n; i++) {
			if(isPrime[i]) continue;
			for(int j = 2*i; j <= n; j+=i) {
				isPrime[j] = true;
			}

		}
		return isPrime;

	}

//	For Input.txt and Output.txt

//	FileInputStream in = new FileInputStream("input.txt");
//	FileOutputStream out = new FileOutputStream("output.txt");
//	PrintWriter pw = new PrintWriter(out);
//	Scanner sc = new Scanner(in);

// 	sc.nextLine()

}


import java.util.*;

public class test2
{
	static long dp[][];

	 static long mod = 1000000007;
	   static long pow(long a , long b , long c)
	   {

		   if(b==0)
			   return 1;

		   long ans = pow(a,b/2,c);
		   if(b%2 == 0)
			   return ans*ans%c;

		   return ans*ans%c*a%c;
	   }

	   static long modInverse(long a , long b)
	   {
		   return pow(a,b-2,mod);
	   }

	   static long fact[];

	   static long ways(int pos , int space , int arr[] , int n)
	   {
		   if(space < 0)
			   return 0;

		   if(pos == arr.length)
		   {
			   if(space == 0)
				   return 1;

			   return 0;
		   }

		   if(space < arr[pos])
			   return 0;

		   if(dp[pos][space] != -1)
			   return dp[pos][space];

		   dp[pos][space] = 0;
		   for(int i = arr[pos] ; i <= n ; i++)
		   {
			   if(pos == 0)
			   {
				   if(i > 0)
					   dp[pos][space] += modInverse(fact[i-1],mod)*modInverse(i,mod)%mod*modInverse(n,mod)%mod*(n-i)%mod*ways(pos+1,space-i,arr,n)%mod;

				   else
					   dp[pos][space] = ways(pos+1,space,arr,n);
			   }

			   else
				   dp[pos][space] += modInverse(fact[i],mod)*ways(pos+1,space-i,arr,n);

			   dp[pos][space] %= mod;
		   }
		   return dp[pos][space];
	   }
	public static void main(String []args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		fact = new long[n+1];
		fact[0] = 1;
		for(long i = 1 ; i <= n ; i++)
		{
			fact[(int)i] = fact[(int)i-1]*i%mod;
		}

		int arr[] = new int[10];
		for(int i = 0 ; i <= 9  ;i++)
		{
			arr[i] = sc.nextInt();
		}
	dp = new long[10][n+1];
	for(int i = 0;  i <= 9 ; i++)
	{
		for(int j = 0 ; j <= n ; j++)
		{
		dp[i][j] = -1;
		}
	}
	long ans = 0;
	for(int i = 1 ; i <= n ; i++)
	{
		ans += fact[i]*ways(0,i,arr,i)%mod;
		ans %= mod;
	}

	ans %= mod;
	System.out.println(ans);
	}
}


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

public class C_436
{

	InputStream is;
	PrintWriter out;
	int n;
	// long a[];
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	long a;
	long b;
	long f;
	long k;
	long count;

	void solve()
	{
		a = nl();
		b = nl();
		f = nl();
		k = nl();
		if (check())
		{
			out.println(count);
		} else
		{
			out.println(-1);
		}
	}

	boolean check()
	{
		boolean flag = true;
		count = 0;
		long petrol = b;
		for (int i = 1; i <= k; i++)
		{
			if (i == k)
			{
				if (i % 2 == 1)
				{
					petrol = petrol - f;
					if (petrol < 0)
					{
						return false;
					}
					if (petrol < a - f)
					{
						petrol = b;
						count++;
					}
					petrol -= a - f;
					if (petrol < 0)
					{
						return false;

					}
				} else
				{
					petrol -= a - f;
					if (petrol < 0)
					{
						return false;
					}
					if (petrol < (f))
					{
						petrol = b;
						count++;
					}
					petrol -= f;
					if (petrol < 0)
					{
						return false;
					}
				}
			} else
			{
				if (i % 2 == 1)
				{

					petrol = petrol - f;
					// tr(petrol, " ++ ", i, count);
					if (petrol < 0)
					{
						return false;
					}
					if (petrol < 2 * (a - f))
					{
						petrol = b;
						count++;
					}
					petrol -= a - f;
					// tr(petrol, " -- ", i, count);
				} else
				{
					petrol -= a - f;
					// tr(petrol, " ++ ", i, count);
					if (petrol < 0)
					{
						return false;
					}
					if (petrol < 2 * (f))
					{
						petrol = b;
						count++;
					}
					petrol -= f;
					// tr(petrol, " -- ", i, count);

				}
			}
		}
		return true;

	}

	void run() throws Exception
	{
		String INPUT = "C:\\Users\\Admin\\Desktop\\input.txt";
		is = oj ? System.in : new FileInputStream(INPUT);
		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 Thread(null, new Runnable()
		{
			public void run()
			{
				try
				{
					new C_436().run();
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public 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 void tr(Object... o)
	{
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}

}


import java.util.Scanner;

public class CoveredPath {

    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int fV = scanner.nextInt();
        int sV = scanner.nextInt();
        int t = scanner.nextInt();
        int d = scanner.nextInt();

        System.out.println(Path(fV,sV,t,d));

   }

    static int Path(int F,int S,int t,int d)
    {
        int Distance = F;
        for (int i = 1; i < t-1; i++)
        {
            Distance += Math.min(F + i*d , S + (t-1)*d - i*d);
        }

        Distance += S;

        return Distance;
    }

}


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

public class test {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Reader.init(System.in);
		int n=Reader.nextInt();
		int m=Reader.nextInt();

		int humans=n-m;
		if(m==0) {
			System.out.println(1);
		}
		else {
			System.out.println(Math.min(m, humans));
		}

}
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

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


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

public class Main {

	private static class Vipechka {
		int remains_a;
		int need_b;
		int testo_c;
		int cost_d;

		public Vipechka(int remains_a, int need_b, int testo_c, int cost_d) {
			this.remains_a = remains_a;
			this.need_b = need_b;
			this.testo_c = testo_c;
			this.cost_d = cost_d;
		}
	}

	public static int[][] dp = new int[1001][12];

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] parts = br.readLine().split("\\s+");
		int n = Integer.parseInt(parts[0]);
		int m = Integer.parseInt(parts[1]);
		int c = Integer.parseInt(parts[2]);
		int d = Integer.parseInt(parts[3]);
		Vipechka[] vipArr = new Vipechka[m + 1];
		vipArr[0] = new Vipechka(0, 0, c, d);
		for (int i = 1; i <= m; i++) {
			parts = br.readLine().split("\\s+");
			Vipechka vip = new Vipechka(Integer.parseInt(parts[0]),
					Integer.parseInt(parts[1]), Integer.parseInt(parts[2]),
					Integer.parseInt(parts[3]));
			vipArr[i] = vip;
		}

		// dpMine(n, vipArr);
		for (int testo = 0; testo <= n; testo++) {
			for (int i = 0; i < vipArr.length; i++) {
				int nachinkiEnoughFor = vipArr[i].need_b == 0 ? Integer.MAX_VALUE
						: vipArr[i].remains_a / vipArr[i].need_b;
				int testaEnoughFor = testo / vipArr[i].testo_c;
				int maxCanBacke = Math.min(nachinkiEnoughFor, testaEnoughFor);
				for (int k = 0; k <= maxCanBacke; k++) {
					int restTesto = testo - k * vipArr[i].testo_c;
					if (restTesto < 0)
						break;
					int getMoney = (i - 1 >= 0 ? dp[restTesto][i - 1] : 0) + k
							* vipArr[i].cost_d;
					if (dp[testo][i] < getMoney)
						dp[testo][i] = getMoney;
				}
			}
		}
		// int max = Integer.MIN_VALUE;
		// for (int i = 0; i < vipArr.length; i++) {
		// int currMoney = dp[n][i];
		// if (max < currMoney)
		// max = currMoney;
		// }
		System.out.println(dp[n][m]);
	}

	private static void dpMine(int n, Vipechka[] vipArr) {
		for (int testo = 1; testo <= n; testo++) {
			for (int i = 0; i < vipArr.length; i++) {
				int nachinkiEnoughFor = vipArr[i].need_b == 0 ? Integer.MAX_VALUE
						: vipArr[i].remains_a / vipArr[i].need_b;
				int testaEnoughFor = testo / vipArr[i].testo_c;
				int maxCanBacke = Math.min(nachinkiEnoughFor, testaEnoughFor);
				int currMaxMoney = Integer.MIN_VALUE;
				for (int canBake = 0; canBake <= maxCanBacke; canBake++) {
					int currMoney = canBake * vipArr[i].cost_d;
					int currMoneyTmp = currMoney;
					for (int j = 0; j < i; j++) {
						if (testo - canBake * vipArr[i].testo_c > 0) {
							if (currMoney
									+ dp[testo - canBake * vipArr[i].testo_c][j] > currMoneyTmp) {
								currMoneyTmp = currMoney
										+ dp[testo - canBake
												* vipArr[i].testo_c][j];
							}
						}
					}
					if (currMoneyTmp > currMaxMoney)
						currMaxMoney = currMoneyTmp;
				}
				dp[testo][i] = currMaxMoney;
			}
		}
	}

	public static int solve(Vipechka[] vip, int testo, int currIdx) {
		if (currIdx >= vip.length)
			return 0;
		if (currIdx == 0) {
			int nachinkiEnoughFor = vip[currIdx].need_b == 0 ? Integer.MAX_VALUE
					: vip[currIdx].remains_a / vip[currIdx].need_b;
			int testaEnoughFor = testo / vip[currIdx].testo_c;
			int maxCanBacke = Math.min(nachinkiEnoughFor, testaEnoughFor);
			return maxCanBacke * vip[currIdx].cost_d;
		}
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < currIdx; i++) {
			int nachinkiEnoughFor = vip[currIdx].need_b == 0 ? Integer.MAX_VALUE
					: vip[currIdx].remains_a / vip[currIdx].need_b;
			int testaEnoughFor = testo / vip[currIdx].testo_c;
			int maxCanBacke = Math.min(nachinkiEnoughFor, testaEnoughFor);
			for (int j = 0; j <= maxCanBacke; j++) {
				int currMoney = j * vip[currIdx].cost_d;
				int adjustMoney = dp[testo - j * vip[currIdx].testo_c][i];
				if (adjustMoney == 0) {
					adjustMoney = solve(vip, testo - j * vip[currIdx].testo_c,
							i);
					dp[testo - j * vip[currIdx].testo_c][i] = adjustMoney;
				}
				currMoney += adjustMoney;
				if (max < currMoney)
					max = currMoney;
			}
		}
		return max;
	}
}


//package yahia;
import java.io.PrintWriter;
import java.util.*;public class Main {public static void main (String []args) {Scanner sc =new Scanner (System.in);PrintWriter pw =new PrintWriter(System.out);
String w =sc.next();char [] x =w.toCharArray();int a =x.length;String j ="";
if (a<=2) System.out.println(w);
else if (a%2==1) {
     j=x[a/2]+""+x[a/2+1];
     int i =(a/2-1);int s=a/2+2;
     while (i>=0||s<a) {
    	 j=j+x[i];--i;
    	 if (s<a) {
    		 j=j+x[s];++s;
    	 }
     }
     System.out.println(j);
}
else {
	j=j+x[a/2-1]+x[a/2];
	int i =(a-2)/2 -1;int s =a/2+1;
	while (i>0||s<a) {
		if (i>=0) {
			j=j+x[i];
			--i;
		}
		j=j+x[s];++s;
	}
	System.out.println(j);

}}}


import jdk.swing.interop.SwingInterOpUtils;

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

public class prac1 {
    public static void main(String[] args) throws IOException {
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String a=br.readLine();
//        System.out.println(a);
        if(n==0)
        {
            System.out.println("NO");
        }
        else
        {
            int count=0;
            for(int i=1;i<n;i++)
            {
//                System.out.println("iter: "+(i+1));
                if(a.charAt(i)==a.charAt(i-1))
                    continue;
//                System.out.println("wrong");
                if(a.charAt(i)=='F')
                    count++;
                else
                    count--;
            }
            if(count>0)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }
}


/**
 *
 */

 // @author Winry Rockbell
 import java.util.Scanner;

public class HelloWorld {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	int n,k,d;
	long mod=1000000007;
	Scanner in = new Scanner(System.in);
	n=in.nextInt();
	k=in.nextInt();
	d=in.nextInt();
	long dp[]=new long[101];
	long dp1[]=new long[101];
	dp[0]=1;dp1[0]=1;
	dp[1]=1;dp1[1]=1;
	for(int i=1;i<=n;i++)
	{dp[i]=0;
		for(int j=1;j<d;j++)
		{
			if(i-j>=0)
				dp[i]+=dp[i-j];
			dp[i]=dp[i]%mod;
		}
	}
	for(int i=1;i<=n;i++)
	{dp1[i]=0;
		for(int j=1;j<=k;j++)
		{
			if(i-j>=0)
				dp1[i]+=dp1[i-j];
			dp1[i]=dp1[i]%mod;
		}
	}
	long ki=dp1[n]-dp[n];
	if(ki<0)
		ki=ki+mod;
	if(n==0)
		ki=0;
	System.out.println(""+ki);
	}

}


/**
 *
 */

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

/**
 * @author Rachna
 *
 */
public class MagicForest {

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int count = 0;

		for (int i = 1; i <= n; i++) {

			for (int j = i + 1; j <= n; j++) {

				int k = i ^ j;
				if (k <= n && i+j > k && k >=j) {
					count++;
                }

			}
		}

		System.out.println(count);
	}

}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.logging.StreamHandler;

public class Second {
	static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
	static PrintWriter out;

    static long count(long x, long k) {
        long sum = 0, d = 1;
        for (;d <= x;d *= k) sum += x/d;
        return(sum);
    }

	public static void main(String[] args) throws Exception {
		in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

        long n = next(), k = next();
        long min = 0;
        long max = 1000000000;

        while (max - min!=1) {
            if (count((max+min)/2,k) >= n) {
                max = (max+min)/2;
            } else min = (max+min)/2;
        }

        out.println(max);

        out.println();
		out.close();
	}
}


 //package Contest553;

import java.io.PrintWriter;
import java.util.Scanner;

public class mainF {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {
        long mod=(long)1e9+7;
        int n=enter.nextInt();
        long s=enter.nextLong();
        int[] arr=new int[n];
        int m=0;
        long CON=n*(n-1)/2;
        CON=bin_pow(CON,mod-2,mod);
        for (int i = 0; i <n ; i++) {
            arr[i]=enter.nextInt();
            m+=arr[i];
        }
        int f_k=0;
        for (int i = 0; i <n-m ; i++) {
            f_k+=arr[i];
        }
        int k=n-m;
        f_k=n-m-f_k;
        /*if(m<n-m){//Если нулей больше чем единиц
            k=m;
            f_k=n-m-f_k;
            m=n-m;
        }*/
        //f_k- кол-во нулей в первой части то есть это начальное состояние причём кол-во нулей меньше кол-ва единиц
        long[][] CM=new long[k+1][k+1];
        for (int i = Math.max(0,k-m); i <CM.length ; i++) {
            CM[i][i]=(1-(long)(i*(m-k+i)+(k-i)*(k-i))*CON);
            if(i<k) CM[i][i+1]=(long)(k-i)*(k-i)*CON;
            if(i>0)CM[i][i-1]=(long)i*(m-k+i)*CON;
        }
        MATRIX_mod(CM,mod);
        CM=bin_pow(CM,s,mod);
        System.out.println((CM[f_k][k]+mod)%mod);

    }
    public static long bin_pow(long a,long b, long mod){//a^b %mod
        long ans=1;
        while(b!=0){
            if((b&1)==1) ans*=a;
            a*=a;
            ans%=mod;
            a%=mod;
            b>>=1;
        }
        return ans;
    }

    public static long[][] bin_pow(long[][] a,long b, long mod){//a^b %mod
        long[][] ans=new long[a.length][a.length];
        for (int i = 0; i <ans.length ; i++) ans[i][i]=1;
        while(b!=0){
            if((b&1)==1) ans=MATRIX_mult(ans,a);
            a=MATRIX_mult(a,a);
            MATRIX_mod(ans,mod);
            MATRIX_mod(a,mod);
            b>>=1;
        }
        return ans;
    }
    public static long[][] MATRIX_mult(long[][] a, long[][] b) { //b не меняем a=a*b;
        long[][] c=new long[a.length][a.length];
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                for (int k = 0; k <a.length ; k++) {
                    c[i][j]+=a[i][k]*b[k][j];
                    c[i][j]%=(long)(1e9+7);
                }
            }
        }
        return c;
    }
    public static void MATRIX_mod(long[][] a, long mod){
        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a.length ; j++) {
                a[i][j]%=mod;
            }
        }
    }
}


import java.util.*; import java.lang.*; import java.io.*;
public class Metro {

  public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt(); int diff =0;
  long sum = 0;
  sum += c*2;
  int min = Math.min(a,b);
  sum +=min*2+1;
if((a-b)==0)
sum -=1;
  System.out.println(sum);
  }
}


import java.util.*;
public class c {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int n = input.nextInt(), a = input.nextInt()-1, b = input.nextInt()-1, k = input.nextInt();
    int[] dp = new int[n];
    dp[a] = 1;
    for(int i = 0; i<k; i++)
    {
        int[] csum = csum(dp);
        //System.out.println(Arrays.toString(dp));
        int[] next = new int[n];
        for(int j = 0; j<n; j++)
        {
            if(j == b) continue;
            int min = -1, max = -1;
            if(j < b)
            {
                min = 0;
                max = (j+b-1)/2;
            }
            else
            {
                max = n-1;
                min = (j+b)/2+1;
            }
            //int maxDist = Math.abs(b - j) - 1;
            //int min = Math.max(0, j - maxDist);
            //int max = Math.min(n-1, j + maxDist);
            //System.out.println(j+" "+min+" "+max+" "+query(csum, min, max)+" "+dp[j]);
            int nn = query(csum, min, max) - dp[j];
            if(nn < 0) nn += mod;
            next[j] = nn;
        }
        dp = next;
    }
    //System.out.println(Arrays.toString(dp));
    System.out.println(csum(dp)[n-1]);
}
static int[] csum(int[] a)
{
    int n = a.length;
    int[] res = new int[n];
    res[0] = a[0];
    for(int i = 1; i<n; i++) res[i] = (a[i] + res[i-1])%mod;
    return res;
}
static int query(int[] csum, int a, int b)
{
    int res = csum[b];
    if(a > 0) res -= csum[a-1];
    if(res < 0) res += mod;
    return res;
}
static int mod = 1000000007;
}


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int cnt = 0;
        for(int i=0; i<=1000; ++i) {
            for(int j=0; j<=1000; ++j) {
                if(i*i+j==n&&i+j*j==m) cnt++;
            }
        }
        System.out.println(cnt);
    }
}


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

public class Main {
	  int 	getint(BufferedReader sc) throws java.lang.Exception
			{
		//	  String ss=sc.readLine();
		    	int a= Integer.parseInt(sc.readLine());
		    	return a;
			}
		  ArrayList<Integer> getlistint(BufferedReader sc) throws java.lang.Exception
		  {
			  ArrayList<Integer> res=new ArrayList<>();

			  String s=sc.readLine();
			  String[] ss=s.split(" ");

			  for(int i=0;i<ss.length;i++)
			  {
				//  String ss=sc.readLine();
			    	int a=Integer.valueOf(ss[i]);
			    	res.add(a);
			  }

			  return res;
		  }
		  ArrayList<Float> getlistfl(BufferedReader sc) throws java.lang.Exception
		  {
			  ArrayList<Float> res=new ArrayList<>();

			  String s=sc.readLine();
			  String[] ss=s.split(" ");

			  for(int i=0;i<ss.length;i++)
			  {
				//  String ss=sc.readLine();
			    	float a=Float.valueOf(ss[i]);
			    	res.add(a);
			  }

			  return res;
		  }
		  ArrayList<Long> getlist(BufferedReader sc) throws java.lang.Exception
		  {
			  ArrayList<Long> res=new ArrayList<>();

			  String s=sc.readLine();
			  String[] ss=s.split(" ");

			  for(int i=0;i<ss.length;i++)
			  {
				//  String ss=sc.readLine();
			    	long a=Long.valueOf(ss[i]);
			    	res.add(a);
			  }

			  return res;
		  }
		  ArrayList<Character> getlistchar(BufferedReader sc) throws java.lang.Exception
		  {
			  ArrayList<Character> res=new ArrayList<>();

			  String s=sc.readLine();
			//  String[] ss=s.split(" ");

			  for(int i=0;i<s.length();i++)
			  {
				//  String ss=sc.readLine();
			    	//char[] a=ss[i].toCharArray();
			    	res.add(s.charAt(i));
			  }

			  return res;
		  }

		  static int n;
		  static int b[];
		  static StringBuffer ans = new StringBuffer("");
		  static BufferedReader bf;
		  static class pair{
		        int a,b;
		        pair(int a,int b){
		            this.a =a;
		            this.b =b;
		        }
		    }private static StringBuilder result = new StringBuilder();

		    public static void main(String[] args) throws Exception
		    {
		    	Main pra=new Main();
		    	//Scanner sc = new Scanner(System.in);
		      //  int tc;
		    	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		    //	Scanner in=new Scanner(System.in);
			 //   long t=Long.parseLong(br.readLine());
		    	int max=Integer.MAX_VALUE;
		    	int res=0;
			  int t=1;
			  while(t-->0){
			    //	int num=Integer.parseInt(br.readLine());
			    	ArrayList<Integer> p=pra.getlistint(br);
			    	ArrayList<Integer> p1=pra.getlistint(br);

			    	int sum=0;

			    	for(int i=0;i<p1.size();i++)
			    	{
			    		sum+=p1.get(i);
			    	}
			    	int res1=p.get(1)-sum;
			    	if(sum+10*(p.get(0)-1)>p.get(1))
			    	{
			    		System.out.println("-1");
			    	}else
			    	{
			    		System.out.println(res1/5);
			    	}

		//	 System.out.println(ress);
			 }

		        }

}


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){
	    int velocityprincess = in.ri(), velocitydragon = in.ri(), thoursheadstart = in.ri(), fhoursstraightening = in.ri(), cmilestotravel = in.ri();
	    double t = -(1.0* thoursheadstart * velocitydragon) / (velocityprincess - velocitydragon);
	    double distanceprincess = velocityprincess * t;
	    if (distanceprincess >= cmilestotravel || velocityprincess >= velocitydragon){
		    out.print(0);
		    return;
	    }
	    for(int i = 0; i < 10000000; i++) {
		    t += (-2 * distanceprincess - velocitydragon * fhoursstraightening) / (velocityprincess - velocitydragon);
		    distanceprincess = t * velocityprincess;
		    if(distanceprincess >= cmilestotravel){
			    out.print(i + 1);
			    return;
		    }
	    }
    }
}

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 ri(){
		return readInt();
	}

	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 print(int i) {
		writer.print(i);
	}
}


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

/**
 * Created by vlad on 22.03.16.
 */
public class problemB {

    public void solution(Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();
        if (n == 0) {
            out.println(0);
            return;
        }
        int i = 0;
        int ans = 0;
        while (n > 0 && k > 0) {
            if (n % 10 != 0) {
                ans++;
            } else {
                k--;
            }
            i++;
            n /= 10;
        }

        if (k != 0) {
            out.println(i - 1);
        } else {
            out.println(ans);
        }
    }

    public static void main(String args[]) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        new problemB().solution(in, out);

        in.close();
        out.close();
    }

}


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

public class ProbE implements Runnable{

	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	private static int mod = (int)1e9+7;

	private static void soln(){
		String s = nextLine();
		HashSet<String> hs = new HashSet<String>();
		hs.add(s);
		String temp = s;
		for	(int i=0;i<s.length();i++){
//			System.out.println(temp);
			StringBuilder s1 = new StringBuilder("");
			s1.append(temp.charAt(temp.length()-1));
//			System.out.println("asd "+s1);
			s1.append(temp.substring(0,temp.length()-1));
//			System.out.println(s1);
			temp = s1.toString();
			hs.add(temp);
		}
//		pw.println(hs);
		pw.println(hs.size());

	}

	public void run (){
		soln();
	}

	public static void main(String[] args) throws InterruptedException{
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		Thread t = new Thread(null, new ProbE(), "ProbD", 1<<28);
		t.start();
		t.join();
		pw.close();
	}

	// To Get Input
	// Some Buffer Methods

	public static void InputReader(InputStream stream1) {
		stream = stream1;
	}

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

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

	private static 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++];
	}

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

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

	private static 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();
	}

	private static String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}

	private static long[] nextLongArray(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		return arr;
	}

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

	private static void pArray(long[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

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

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

}


import java.util.Scanner;

public class Main{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long n = scan.nextInt(), m = scan.nextInt();
		long x  = power((power(2,m,1000000007))-1, n, 1000000007);
		System.out.println(x);
	}
	static long power(long x, long y, long p)
    {
        // Initialize result
        long res = 1;

        // Update x if it is more
        // than or equal to p
        x = x % p;

       if (x == 0) return 0; // In case x is divisible by p;

        while (y > 0)
        {
            // If y is odd, multiply x
            // with result
            if((y & 1)==1)
                res = (res * x) % p;

            // y must be even now
            // y = y / 2
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        String[] line = scan.nextLine().split(" ");
        int n1 = Integer.parseInt(line[0]);
        int n2 = Integer.parseInt(line[1]);
        int k1 = Integer.parseInt(line[2]);
        int k2 = Integer.parseInt(line[3]);

        boolean firstPlayerTurn = true;

        while (true) {
            if (firstPlayerTurn) {
                if (n1 == 0) {
                    System.out.println("Second");
                    return;
                } else {
                    n1--;
                }
            } else {
                if (n2 == 0) {
                    System.out.println("First");
                    return;
                } else {
                    n2--;
                }
            }

            firstPlayerTurn = !firstPlayerTurn;
        }
    }
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
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 Niyaz Nigmatullin
 */
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);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {

    final int MOD = 1000000007;

    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        char[] c = in.next().toCharArray();
        int n = c.length;
        long ans = 0;
        long t = 1;
        for (int i = 0; i + 1 < n; i++) t = t * 2 % MOD;
        for (int i = 0; i < n; i++) {
            if (c[i] == '0') continue;
            long cur = t;
            for (int j = i + 1; j < n; j++) cur = cur * 2 % MOD;
            ans = (ans + cur) % MOD;
        }
        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 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.util.*;
import java.io.*;

public class FriendsandPresents {

	static long cnt1;
	static long cnt2;
	static long x;
	static long y;

	public static void main(String[] args) throws IOException, FileNotFoundException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader in = new BufferedReader(new FileReader("FriendsandPresents"));

		StringTokenizer st = new StringTokenizer(in.readLine());
		cnt1 = Integer.parseInt(st.nextToken());
		cnt2 = Integer.parseInt(st.nextToken());
		x = Integer.parseInt(st.nextToken());
		y = Integer.parseInt(st.nextToken());

		long min = 1;
		long max = (long)(1e10);
		while (min < max) {
			long middle = (min  +max)/2;
			if (check(middle)) {
				max = middle;
			}
			else min = middle+1;
		}

		System.out.println(min);

	}

	public static boolean check(long num) {
		long divnone = num - (num/x + num/y - num/(x*y));
		long divy = num/y - num/(x*y);
		long divx = num/x - num/(x*y);
		long c1_left = cnt1 - divy;
		if (c1_left<0) c1_left=0;
		long c2_left = cnt2 - divx;
		if (c2_left<0) c2_left=0;
		return c2_left + c1_left <= divnone;
	}
}


import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

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

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	String[] ans = {
			"Washington",
			"Adams",
			"Jefferson",
			"Madison",
			"Monroe",
			"Adams",
			"Jackson",
			"Van Buren",
			"Harrison",
			"Tyler",
			"Polk",
			"Taylor",
			"Fillmore",
			"Pierce",
			"Buchanan",
			"Lincoln",
			"Johnson",
			"Grant",
			"Hayes",
			"Garfield",
			"Arthur",
			"Cleveland",
			"Harrison",
			"Cleveland",
			"McKinley",
			"Roosevelt",
			"Taft",
			"Wilson",
			"Harding",
			"Coolidge",
			"Hoover",
			"Roosevelt",
			"Truman",
			"Eisenhower",
			"Kennedy",
			"Johnson",
			"Nixon",
			"Ford",
			"Carter",
			"Reagan",
	};

	private void solve() throws IOException {
		out.println(ans[nextInt() - 1]);
	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	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 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;
	}
}


import java.util.Scanner;

public class DeclinedFinalist {

	public static void main(String[] args) {
		/*
		 * first convert input string to integer value
		 * for this problem is n array lenght and array itself
		 */
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();

		/*
		 * first argument evaluation
		 */
		int K = 0;
		try {
			K = Integer.valueOf(str1);
		} catch (Exception e) {
			System.err.println("Not valid input!");
		}

		if((K < 1) | (K > 25)) {
			return;
		}

		int[] arr = stringTointArray(str2, 1, 1000000);

		/*
		 * actual algorithm (after filtering data)
		 */

		int max_finalist = 25;

		for (int i = 0; i < (arr.length); i++) {
			if (arr[i] == 1000000) {
				System.out.println((1000000 - 25));
				return;
			}
			if(arr[i] > max_finalist) {
				max_finalist = arr[i];
			}
		}

		System.out.println((max_finalist - 25));

	}

	/**
	 * Method convert string to integer array in range min to max
	 * @param in	input string
	 * @param min	minimal integer value of array element
	 * @param max	maximal integer value of array element
	 * @return		array of integer created from string
	 */
	private static int[] stringTointArray(String in, int min, int max) {
		String[] str_arr = in.split(" ");
		int[] out = new int[str_arr.length];

		try {
			for (int i = 0; i < out.length; i++) {
				out[i] = Integer.valueOf(str_arr[i]);
				if ((out[i] < min) | (out[i] > max)) {
					System.err.println("Input data out of range!");
					return null;
				}
			}
		} catch (Exception e) {
			System.err.println("Wrong input data!");
			return null;
		}

		return out;
	}

}


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

public class Main
{
	//Fast IO class
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        public FastReader()
        {
        	boolean env=System.getProperty("ONLINE_JUDGE") != null;
        	if(!env) {
        		try {
					br=new BufferedReader(new FileReader("src\\input.txt"));
				} catch (FileNotFoundException e) {
					e.printStackTrace();
				}
        	}
        	else {
        		br = new BufferedReader(new
                        InputStreamReader(System.in));
        	}
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
        long nextLong()
        {
            return Long.parseLong(next());
        }
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static long MOD=1000000000+7;
    //Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
    //Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
    //Prime Number Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i*i<=n;i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
    //Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i)
            if(isPrime[i]==true)
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;
    }
    // Pair
    static class pair{
    	double x,y;
    	pair(double a,double b){
    		this.x=a;
    		this.y=b;
    	}
    	public boolean equals(Object obj) {
    		if(obj == null || obj.getClass()!= this.getClass())
                return false;
            pair p = (pair) obj;
            return (this.x==p.x && this.y==p.y);
        }
    	public int hashCode() {
            return Objects.hash(x, y);
        }
    }
    //Main function(The main code starts from here)
    public static void main (String[] args) throws java.lang.Exception
    {
        FastReader sc=new FastReader();
    	int test=1;
        while(test-->0) {
        	long n=sc.nextLong();
        	ArrayList<Long> a=new ArrayList<>();
        	for(long i=2;i*i<=n;i++) {
        		if(n%i==0) {
        			if(i*i==n) a.add(i);
        			else {
        				a.add(i);
        				a.add(n/i);
        			}
        		}
        	}
        	long ans=0;
        	a.add(n);
        	for(Long x: a) ans=gcd(ans,x);
        	System.out.println(ans);
        }
    }
}


import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		String line = scanner.nextLine();

		BigInteger n = new BigInteger(line);
		BigInteger b2 = new BigInteger("2");

		BigInteger soma = n.multiply(n).add(n).divide(b2).mod(b2);

		scanner.close();

		System.out.println(soma.intValue());
	}
}


import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class A {

    public A() throws Exception {
        int k = in.nextInt();
        int b = in.nextInt();
        int n = in.nextInt();
        int t = in.nextInt();

        long cur = 1;
        for (int i=0; i<n; i++) {
            cur = cur*k+b;
            if (cur>t) {
                System.out.println(n-i);
                break;
            }
        }
        if (cur<=t) {
            System.out.println(0);
        }
    }

    Scanner in = new Scanner(System.in);
    public static void main(String[] args) throws Exception { // {{{
        new A();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
}


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

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

	Scanner in = new Scanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	void work() {
		int n=in.nextInt();
		String str=in.next();
		long[][] dp=new long[n][n];
		out.println(dfs(str,0,n-1,dp));
		out.flush();
	}

	long dfs(String str,int s,int e,long[][] dp){
	    if(s>e) return 0;
	    if(dp[s][e]>0) return dp[s][e];
	    dp[s][e]=1+dfs(str,s+1,e,dp);
        for(int i=s+1;i<=e;i++){
            if(str.charAt(i)==str.charAt(s)){
                dp[s][e]=Math.min(dfs(str,s+1,i-1,dp)+dfs(str,i,e,dp),dp[s][e]);
            }
        }
        return dp[s][e];
	}
}