import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int ab = sc.nextInt(); ab sc.nextInt() sc.nextInt sc int aa = sc.nextInt(); aa sc.nextInt() sc.nextInt sc int bb = sc.nextInt(); bb sc.nextInt() sc.nextInt sc int price = 0; price 0 if(a/2 > ab){
            a = ab*2;
        } a/2 > ab a/2 a 2 ab {
            a = ab*2;
        } a = ab*2 a ab*2 ab 2 if(b/2 > ab){
            b = ab*2;
        } b/2 > ab b/2 b 2 ab {
            b = ab*2;
        } b = ab*2 b ab*2 ab 2 if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        } a + b >= ab*2 a + b a b ab*2 ab 2 {
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        } if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            } aa<bb aa bb {
                price += aa*ab*2 + (bb-aa)*b;
            } price += aa*ab*2 + (bb-aa)*b price aa*ab*2 + (bb-aa)*b aa*ab*2 aa*ab*2 aa ab 2 (bb-aa)*b (bb-aa) bb aa b if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            } aa>bb aa bb {
                price += bb*ab*2 + (aa-bb)*a;
            } price += bb*ab*2 + (aa-bb)*a price bb*ab*2 + (aa-bb)*a bb*ab*2 bb*ab*2 bb ab 2 (aa-bb)*a (aa-bb) aa bb a {
                price += bb*ab*2;
            } price += bb*ab*2 price bb*ab*2 bb*ab*2 bb ab 2 {
            price += aa*a + bb*b;
        } price += aa*a + bb*b price aa*a + bb*b aa*a aa a bb*b bb b System.out.println(price) System.out.println System.out System System.out price String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ab = sc.nextInt();
        int aa = sc.nextInt();
        int bb = sc.nextInt();
        int price = 0;
        if(a/2 > ab){
            a = ab*2;
        }
        if(b/2 > ab){
            b = ab*2;
        }
        if(a + b >= ab*2){
            if(aa<bb){
                price += aa*ab*2 + (bb-aa)*b;
            }else if(aa>bb){
                price += bb*ab*2 + (aa-bb)*a;
            }else{
                price += bb*ab*2;
            }
        }
        else{
            price += aa*a + bb*b;
        }
        System.out.println(price);
    }
}