/*

import "core"
import "procon"

fn min(x Int, y Int) Int {
  if (x < y) {
    x
  } else {
    y
  }
}
fn max(x Int, y Int) Int {
  if (x > y) {
    x
  } else {
    y
  }
}

fn main() {
  a := read_int()
  b := read_int()
  c := read_int()
  x := read_int()
  y := read_int()

  m := max(x, y)

  ans := 0
  for i in range(0, m) {
    an := max(x - i, 0)
    bn := max(y - i, 0)
    cost := an*a + bn*b + i*2*c
    if (ans == 0) {
      ans = cost
    } else {
      ans = min(ans, cost)
    }
  }
  println(ans)
}

main()

*/

#include "stdint.h"
#include "stdbool.h"
#include "inttypes.h"
#include "stdio.h"
#include "math.h"


struct core_string_String {
char* p;
int64_t len;
};
struct core_vec_Vec_core_string_String {
struct core_string_String* data;
bool* isinit;
int64_t cap;
int64_t len;
};
struct Array1024_core_prelude_Char { char data[1024]; };

void core_prelude_destructGG_core_prelude_Int(int64_t core_prelude_x);
void* core_pointer_nullGG_();
char* core_pointer_plusexclGcore_prelude_CharG_core_pointer_Ptr_core_prelude_Char_core_prelude_Int(char* core_pointer_p, int64_t core_pointer_i);
char core_string_getGG_core_prelude_CString_core_prelude_Int(char* core_string_cs, int64_t core_string_i);
char core_string_charGG_core_prelude_Int(int64_t core_string_c);
int64_t procon_read_intGG_();
int64_t c_minGG_core_prelude_Int_core_prelude_Int(int64_t c_x, int64_t c_y);
int64_t c_maxGG_core_prelude_Int_core_prelude_Int(int64_t c_x, int64_t c_y);
void c_mainGG_();


void core_prelude_destructGG_core_prelude_Int(int64_t core_prelude_x) {
}
bool core_prelude_true;
bool core_prelude_false;
bool core_definitions_is_windows;
bool core_definitions_is_compiletime;
bool core_definitions_is_runtime;
bool core_definitions_is_jscodegen;
float core_math_M_PI;
void* core_pointer_nullGG_() {
void* core_pointer_tmpid30 = ((void*)(0));
return core_pointer_tmpid30;
}
void* core_pointer_null;
char* core_pointer_plusexclGcore_prelude_CharG_core_pointer_Ptr_core_prelude_Char_core_prelude_Int(char* core_pointer_p, int64_t core_pointer_i) {
char* core_pointer_tmpid35 = ((char*)((((int64_t)(core_pointer_p)) + core_pointer_i)));
return core_pointer_tmpid35;
}
char core_string_getGG_core_prelude_CString_core_prelude_Int(char* core_string_cs, int64_t core_string_i) {
char core_string_tmpid36 = (*(core_pointer_plusexclGcore_prelude_CharG_core_pointer_Ptr_core_prelude_Char_core_prelude_Int(((char*)(core_string_cs)), core_string_i)));
return core_string_tmpid36;
}
char core_string_charGG_core_prelude_Int(int64_t core_string_c) {
char core_string_tmpid39 = ((char)(core_string_c));
return core_string_tmpid39;
}
char core_string_cr;
char core_string_lf;
#define procon_INF 999999999
#define procon_MOD 1000000007
int64_t procon_read_intGG_() {
int64_t procon_ret;
scanf("%" PRId64, &procon_ret);
int64_t procon_tmpid65 = procon_ret;
return procon_tmpid65;
}
bool procon_is_debug;
int64_t c_minGG_core_prelude_Int_core_prelude_Int(int64_t c_x, int64_t c_y) {
int64_t __floritmp0;
if ((c_x < c_y)) {
__floritmp0 = c_x;
} else {__floritmp0 = c_y;
}int64_t c_tmpid67 = __floritmp0;
return c_tmpid67;
}
int64_t c_maxGG_core_prelude_Int_core_prelude_Int(int64_t c_x, int64_t c_y) {
int64_t __floritmp1;
if ((c_x > c_y)) {
__floritmp1 = c_x;
} else {__floritmp1 = c_y;
}int64_t c_tmpid66 = __floritmp1;
return c_tmpid66;
}
void c_mainGG_() {
int64_t c_a = procon_read_intGG_();
int64_t c_b = procon_read_intGG_();
int64_t c_c = procon_read_intGG_();
int64_t c_x = procon_read_intGG_();
int64_t c_y = procon_read_intGG_();
int64_t c_m = c_maxGG_core_prelude_Int_core_prelude_Int(c_x, c_y);
int64_t c_ans = 0;
{
int64_t c_i = 0;
while ((c_i <= c_m)) {
int64_t c_an = c_maxGG_core_prelude_Int_core_prelude_Int((c_x - c_i), 0);
int64_t c_bn = c_maxGG_core_prelude_Int_core_prelude_Int((c_y - c_i), 0);
int64_t c_cost = (((c_an * c_a) + (c_bn * c_b)) + ((c_i * 2) * c_c));
if ((c_ans == 0)) {
core_prelude_destructGG_core_prelude_Int(c_ans);
c_ans = c_cost;
;
} else {core_prelude_destructGG_core_prelude_Int(c_ans);
c_ans = c_minGG_core_prelude_Int_core_prelude_Int(c_ans, c_cost);
;
};
(c_i += 1);
};

}
;
;
;
printf("%lld", c_ans);
;
;
printf("%s", "\n");
;
;
;
core_prelude_destructGG_core_prelude_Int(c_ans);
core_prelude_destructGG_core_prelude_Int(c_m);
core_prelude_destructGG_core_prelude_Int(c_y);
core_prelude_destructGG_core_prelude_Int(c_x);
core_prelude_destructGG_core_prelude_Int(c_c);
core_prelude_destructGG_core_prelude_Int(c_b);
core_prelude_destructGG_core_prelude_Int(c_a);
}

void flori_main() {
core_prelude_true = 1;
core_prelude_false = 0;
core_definitions_is_windows = 
#ifdef _WIN32
#define is_windows true
#elif _WIN64
#define is_windows true
#else
#define is_windows false
#endif
  is_windows;
core_definitions_is_compiletime = 
#ifdef FLORI_COMPILETIME
#define is_compiletime true
#else
#define is_compiletime false
#endif
  is_compiletime;
core_definitions_is_runtime = !(core_definitions_is_compiletime);
core_definitions_is_jscodegen = 
#ifdef FLORI_JSCODEGEN
#define is_jscodegen true
#else
#define is_jscodegen false
#endif
  is_jscodegen;
core_math_M_PI = M_PI;
core_pointer_null = core_pointer_nullGG_();
core_string_cr = core_string_charGG_core_prelude_Int(13);
core_string_lf = core_string_charGG_core_prelude_Int(10);
procon_is_debug = core_prelude_true;
c_mainGG_();
}
int main(int argc, char** argv) { flori_main(); }


Measured memory_bytes: 128