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 c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	}
} 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 c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	}
} Main 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 x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	} main {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	} 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 c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc int big = 0; big 0 if(x >= y) {
			big = x;
		}else {
			big = y;
		} x >= y x y {
			big = x;
		} big = x big x {
			big = y;
		} big = y big y int abs = Math.abs(x - y); abs Math.abs(x - y) Math.abs Math x - y x y int sum = 0; sum 0 if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		} a + b >= 2 * c a + b a b 2 * c 2 c {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		} sum = (big - abs) * (2 * c) sum (big - abs) * (2 * c) (big - abs) big abs (2 * c) 2 c if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == x && a >= (2 * c) big == x big x a >= (2 * c) a (2 * c) 2 c {
				sum += (abs * (2 * c));
			} sum += (abs * (2 * c)) sum (abs * (2 * c)) abs (2 * c) 2 c if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == x && a < (2 * c) big == x big x a < (2 * c) a (2 * c) 2 c {
				sum += (abs * a);
			} sum += (abs * a) sum (abs * a) abs a if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == y && b >= (2 * c) big == y big y b >= (2 * c) b (2 * c) 2 c {
				sum += (abs * (2 * c));
			} sum += (abs * (2 * c)) sum (abs * (2 * c)) abs (2 * c) 2 c if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == y && b < (2 * c) big == y big y b < (2 * c) b (2 * c) 2 c {
				sum += (abs * b);
			} sum += (abs * b) sum (abs * b) abs b {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		} sum = (big - abs) * (a + b) sum (big - abs) * (a + b) (big - abs) big abs (a + b) a b if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == x && a >= (2 * c) big == x big x a >= (2 * c) a (2 * c) 2 c {
				sum += (abs * (2 * c));
			} sum += (abs * (2 * c)) sum (abs * (2 * c)) abs (2 * c) 2 c if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == x && a < (2 * c) big == x big x a < (2 * c) a (2 * c) 2 c {
				sum += (abs * a);
			} sum += (abs * a) sum (abs * a) abs a if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == y && b >= (2 * c) big == y big y b >= (2 * c) b (2 * c) 2 c {
				sum += (abs * (2 * c));
			} sum += (abs * (2 * c)) sum (abs * (2 * c)) abs (2 * c) 2 c if(big == y && b < (2 * c)) {
				sum += (abs * b);
			} big == y && b < (2 * c) big == y big y b < (2 * c) b (2 * c) 2 c {
				sum += (abs * b);
			} sum += (abs * b) sum (abs * b) abs b System.out.println(sum) System.out.println System.out System System.out sum 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 c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	}
} public class Main{

	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 x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	}
} 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 c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int big = 0;
		if(x >= y) {
			big = x;
		}else {
			big = y;
		}
		int abs = Math.abs(x - y);
		int sum = 0;
		
		if(a + b >= 2 * c) {
			sum = (big - abs) * (2 * c);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}else {
			sum = (big - abs) * (a + b);
			if(big == x && a >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == x && a < (2 * c)) {
				sum += (abs * a);
			}else if(big == y && b >= (2 * c)) {
				sum += (abs * (2 * c));
			}else if(big == y && b < (2 * c)) {
				sum += (abs * b);
			}
		}
		System.out.println(sum);
	}
}