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

public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	}
} import java.util.Scanner; Scanner java.util import java.io.*; io.* java public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	}
} Main public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	} main {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	} Scanner sc= new Scanner(System.in); sc new Scanner(System.in) int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int c = Integer.parseInt(sc.next()); c Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int d = Integer.parseInt(sc.next()); d Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int e = Integer.parseInt(sc.next()); e Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ap =0; ap 0 int bp =0; bp 0 int cp = 0; cp 0 if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		} 2*c <= a && 2*c <= b 2*c <= a 2*c 2 c a 2*c <= b 2*c 2 c b {
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		} if(d<=e)cp =2*e; d<=e d e cp =2*e cp 2*e 2 e if(e<d)cp =2*d; e<d e d cp =2*d cp 2*d 2 d if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		} 2*c <= a 2*c 2 c a {						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		} cp =d*2 cp d*2 d 2 if(d<e)bp =e-d; d<e d e bp =e-d bp e-d e d if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		} 2*c <= b 2*c 2 c b {					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		} cp =e*2 cp e*2 e 2 if(e<d)ap =d-e; e<d e d ap =d-e ap d-e d e if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		} a+b>2*c a+b a b 2*c 2 c {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		} if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			} d>=e d e {
				cp=2*e;
				ap=d-e;
			} cp=2*e cp 2*e 2 e ap=d-e ap d-e d e if(d<e){
				cp=2*d;
				bp=e-d;
			} d<e d e {
				cp=2*d;
				bp=e-d;
			} cp=2*d cp 2*d 2 d bp=e-d bp e-d e d {
			ap=d;
			bp=e;
		} ap=d ap d bp=e bp e System.out.println(ap*a+bp*b+cp*c) System.out.println System.out System System.out ap*a+bp*b+cp*c ap*a+bp*b+cp*c ap*a ap a bp*b bp b cp*c cp c String[] args args public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	}
} Main
import java.util.Scanner;
import java.io.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next()); //Aの値段
		int b = Integer.parseInt(sc.next()); //Bの値段
		int c = Integer.parseInt(sc.next()); //ABの値段
		int d = Integer.parseInt(sc.next()); //Aの枚数
		int e = Integer.parseInt(sc.next()); //Bの枚数
		int ap =0;							//A買う枚数
		int bp =0;							//B買う枚数
		int cp = 0;							//C買う枚数
		if(2*c <= a && 2*c <= b){
			if(d<=e)cp =2*e;
			if(e<d)cp =2*d;
		}else if(2*c <= a){						//A一枚がAB二枚よりも高い場合
			cp =d*2;
			if(d<e)bp =e-d;
		}else if(2*c <= b){					//B一枚がAB二枚よりも高い場合
			cp =e*2;
			if(e<d)ap =d-e;
		}else if(a+b>2*c) {					//A+BがAB二枚よりも高い場合
			if(d>=e) {
				cp=2*e;
				ap=d-e;
			}else if(d<e){
				cp=2*d;
				bp=e-d;
			}
		}else{
			ap=d;
			bp=e;
		}
		System.out.println(ap*a+bp*b+cp*c); 
	}
}
