
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan int C = scan.nextInt(); C scan.nextInt() scan.nextInt scan int X = scan.nextInt(); X scan.nextInt() scan.nextInt scan int Y = scan.nextInt(); Y scan.nextInt() scan.nextInt scan int max = Math.max(X, Y); max Math.max(X, Y) Math.max Math X Y int min = Math.min(X, Y); min Math.min(X, Y) Math.min Math X Y int total = 0; total 0 int remain = 0; remain 0 if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		} max == X max X { //Aピザの残りを買う必要がある
			remain = A;
		} remain = A remain A {
			remain = B;
		} remain = B remain B if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		} A >= 2 * C && B >= 2 * C A >= 2 * C A 2 * C 2 C B >= 2 * C B 2 * C 2 C {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} total = total + max * 2 * C total total + max * 2 * C total max * 2 * C max * 2 * C max 2 C if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		} A >= 2 * C && A + B >= 2 * C && remain == A A >= 2 * C && A + B >= 2 * C && remain == A A >= 2 * C A 2 * C 2 C A + B >= 2 * C A + B A B 2 * C 2 C remain == A remain A {
			total = total + max * 2 * C;
		} total = total + max * 2 * C total total + max * 2 * C total max * 2 * C max * 2 * C max 2 C if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		} B >= 2 * C && A + B >= 2 * C && remain == B B >= 2 * C && A + B >= 2 * C && remain == B B >= 2 * C B 2 * C 2 C A + B >= 2 * C A + B A B 2 * C 2 C remain == B remain B {
			total = total + max * 2 * C;
		} total = total + max * 2 * C total total + max * 2 * C total max * 2 * C max * 2 * C max 2 C if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		} A + B >= 2 * C A + B A B 2 * C 2 C {
			total = total + min * 2 * C + remain * (max - min);
		} total = total + min * 2 * C + remain * (max - min) total total + min * 2 * C + remain * (max - min) total + min * 2 * C + remain * (max - min) total min * 2 * C min * 2 * C min 2 C remain * (max - min) remain (max - min) max min {
			total = A * X + B * Y;
		} total = A * X + B * Y total A * X + B * Y A * X A X B * Y B Y System.out.println(total) System.out.println System.out System System.out total scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	}
}
