stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define print cout <<

#define printl(s) cout << s << endl;

#define rep(i,n) for (int i = 0; i < (n); ++i)

using ll = long long;



const ll modseed = pow(10,9) + 7;



template <typename T>

vector<T> getValues(int num){

    vector<T> values(num);

    for(int i=0;i<num;i++){

        cin >> values.at(i);

    }

    return values;

}



int main(){

  int A,B,C,X,Y;

  cin >> A >> B >> C >> X >> Y;

  ll ans = 0;

  int ar=0;

  int br=0;

  int cr=0;

  for(int c=0;c<=100000;c++){

    int a = max(0, X-c);

    int b = max(0, Y-c);

    ll result = c * 2 * C + a*A+b*B;

    if(ans==0){

      ans = result;

    }else{

      ans = min(ans, result);

    }

  }

  printl(ans);

}


// Faster C++ solution for the same problem (measured speedup: 1.3180772739592503x):
#include <bits/stdc++.h>

using namespace std;



#define printl(s) cout << s << endl;

#define print(s) cout << s << endl; return 0;

#define yes cout << "Yes" << endl; return 0;

#define no cout << "No" << endl; return 0;

#define rep(i,n) for (int i = 0; i <= (n); ++i)

#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)

using ll = long long;



const ll modseed = pow(10,9) + 7;



template <typename T>

vector<T> getValues(ll num){

    vector<T> values(num);

    for(ll i=0;i<num;i++){

        cin >> values.at(i);

    }

    return values;

}



string S;

ll A,B,C,K,N,X,Y,cnt;



int main(){

  cin >> A >> B >> C >> X >>Y;

  rep(c,max(X,Y)*2){

    int a,b;

    a = max(0LL,X-c/2);

    b = max(0LL,Y-c/2);

    if(c==0){

      cnt = a*A+b*B+c*C;

    }else{

      cnt = min(cnt,a*A+b*B+c*C);

    }

  }

  print(cnt);

}
// Slower C++ solution:
#include <iostream>

#include <climits>

#include <cmath>

using namespace std;

int main() {

  int A, B, C, X, Y, min = INT_MAX;

  cin >> A >> B >> C >> X >> Y;

  for (int i = 0; i < 100001; i++) {

    int v = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B;

    if (v < min) min = v;

  }

  cout << min << endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3220097628268281x):
#include <iostream>

#include <climits>

#include <cmath>

using namespace std;

int main() {

  int A, B, C, X, Y, Z = 0, total = 0;

  cin >> A >> B >> C >> X >> Y;

  if (A + B < 2 * C) { // AピザとBピザを別々の方が安い

    total = X * A + Y * B;

  } else { // ABピザの方が安い

    Z = min(X, Y);

    total = 2 * C * Z;

    int restX = max(0, X - Z);

    int restY = max(0, Y - Z);

    if (restX > 0) {

      if (A < 2 * C) { // Aピザを別に買った方が安い

        total += A * restX;

      } else { // ABピザの方が安い

        total += 2 * C * restX;

      }

    }

    if (restY > 0) {

      if (B < 2 * C) {

        total += B * restY;

      } else {

        total += 2 * C * restY; 

      }

    }

  }

  cout << total << endl;

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#include <math.h>

#include <iomanip>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF=1001001001;

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){

  vector<pair<int64_t,int64_t>>p;

  for(int64_t i=2;i*i<=x;i++){

    int cnt=0;

    if(x%i==0){

    while(x%i==0){cnt++;x/=i;}

    p.push_back(make_pair(i,cnt));

    }

  }

  if(x!=1){p.push_back(make_pair(x,1));}

  return p; 

}





int main() {

  int A,B,C,X,Y;

  cin>>A>>B>>C>>X>>Y;

  int ans=1000000007;

  for(int i=0;i<=100000;i++){

      int sum=2*C*i+A*max(X-i,0)+B*max(Y-i,0);

      ans=min(ans,sum);

  }

  cout<<ans<<endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3292930006461237x):
#include <bits/stdc++.h>

using namespace std;

#include <math.h>

#include <iomanip>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



const int mod=1000000007;

const int INF=1001001001;



int main() {

  int A,B,C,X,Y;

  cin>>A>>B>>C>>X>>Y;

  int M=min(X,Y);

  int T=min(A*M+B*M,C*2*M);

  if(M==X){

    int s=Y-M;

    cout<<T+min(B*s,C*2*s)<<endl;

  }

  else{

    int s=X-M;

    cout<<T+min(A*s,C*2*s)<<endl;

  }

  return 0;  

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#include <math.h>

#include <iomanip>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF=1001001001;

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){

  vector<pair<int64_t,int64_t>>p;

  for(int64_t i=2;i*i<=x;i++){

    int cnt=0;

    if(x%i==0){

    while(x%i==0){cnt++;x/=i;}

    p.push_back(make_pair(i,cnt));

    }

  }

  if(x!=1){p.push_back(make_pair(x,1));}

  return p; 

}





int main() {

  int A,B,C,X,Y;

  cin>>A>>B>>C>>X>>Y;

  int ans=1000000007;

  for(int i=0;i<=100000;i++){

      int sum=2*C*i+A*max(X-i,0)+B*max(Y-i,0);

      ans=min(ans,sum);

  }

  cout<<ans<<endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3294523444898139x):
#include <bits/stdc++.h>

using namespace std;

#include <math.h>

#include <iomanip>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int64_t INF=1e18+1;

const int mod = 1000000007;



int main() {

  int A,B,C,X,Y;

  cin>>A>>B>>C>>X>>Y;

  C*=2;

  int ab=0;

  if(X==Y){ab=X;}

  else if(X>Y){ab=Y;}

  else{ab=X;}

  int ans=min({A*X+B*Y,(X-ab)*A+(Y-ab)*B+C*ab,C*max(X,Y)});

  cout<<ans<<endl;

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main(){

  int a, b, c, x, y;

  cin >> a >> b >> c >> x >> y;

  int tmp, ans = 1000000000;

  for(int i = 0; i <= 200000; i++){

    tmp = c*2*i + a*max(0, x-i) + b*max(0, y-i);

    ans = min(ans, tmp);

  }

  cout << ans << endl;



}


// Faster C++ solution for the same problem (measured speedup: 1.1033827311166933x):
#include <bits/stdc++.h>

#define dum(x) cout<<#x<<'='<<x<<endl

#define ll long long

using namespace std;



int main() {

  int a, b, c, x, y;

  cin >> a >> b >> c >> x >> y;

  int ans = 1000000000;

  for (int i = 0; i <= 200000; i+= 2) {

    int tmp = i * c + max(0, x - i / 2) * a + max(0, y - i / 2) * b;

    ans = min(ans, tmp);

  }

  cout << ans << endl;

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#include<string>

#include<algorithm>

#include<cmath>

#include<queue>

#include<climits>

#include<set>

#include<map>

#include<stack>

#define ll long long

using namespace std;



int main() {

	ll a, b, c, x, y, ans;

	cin >> a >> b >> c >> x >> y;

	ans =LLONG_MAX;

	for (ll i = 0; i <= 200000; i++) {

		ans = min(ans,i * c + max(x - i/2,(ll)0)*a + max(y - i/2,(ll)0)*b);

	}

	cout << ans << endl;







}


// Faster C++ solution for the same problem (measured speedup: 1.965827445684235x):
#include <iostream>

#include <vector>

#include <string>

#include <algorithm>

#include <cmath>

#include <queue>

#include <climits>

#include <set>

#include <map>

#include <stack>

#include <iomanip>

#include <tuple>

#define ll long long

using namespace std;

/*階乗*/

ll factorial(ll n){

    if(n==0){

        return 1;

    }

    else{

        return n*factorial(n-1);

    }

}



/* ユークリッドの互除法 最大公約数*/

/*ll gcd(ll a, ll b) {

	ll r;

	r = a % b;

	while (r != 0) {

		a = b;

		b = r;

		r = a % b;

	}

	return b;

}

*/





/*最小公倍数*/

/*

ll lcm(ll a,ll b){

	return a/gcd(a,b)*b;

}

*/



/*二点間の距離*/

double dist(pair<double,double> a,pair<double,double> b){

	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));

}



//繰り返し自乗法

double ism(double aa,ll p){

    double ap=aa;

    double ans=1;

    while(p>0){

        //cout<<"p="<<p<<",ap="<<ap<<endl;

        if(p&1){//奇数が真

            ans*=ap;

        }

        p/=2;

        ap=ap*ap;

    }

    return ans;



}

//繰り返し自乗法(アマリトリバージョン)

ll ismm(ll aa,ll p,ll m){

    ll ap=aa;

    ll ans=1;

    while(p>0){

        //cout<<"p="<<p<<",ap="<<ap<<endl;

        if(p&1){//奇数が真

            ans=(ans*ap)%m;    

        }

        p/=2;              

        ap=(ap*ap)%m;

    }

    return ans;



}

/*

ll solve(ll i,ll m,vector<ll>t,ll n){

    if(m==0){

        return 1;

    }

    if(i>=n){

        return 0;

    }

    

    

    cout<<i+1<<" "<<m<<endl;

    cout<<i+1<<" "<<m-t[i]<<endl;

    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);

    return res;

}

*/



//小数点12桁

struct all_init

{

    all_init()

    {

        cout << fixed << setprecision(12);

    }

} All_init;





int main()

{

    ll a,b,c,x,y,t=0;

    cin>>a>>b>>c>>x>>y;

    if(min(x,y)==x){

        t+=2*min(x,y)*c+abs(max(x,y)-min(x,y))*b;

    }

    else if(min(x,y)==y){

        t+=2*min(x,y)*c+abs(max(x,y)-min(x,y))*a;

        //cout<<2*min(x,y)*c<<endl;

        //cout<<abs(max(x,y)-min(x,y))*a<<endl;;

    }

    





    cout<<min({a*x+b*y,2*max(x,y)*c,t})<<endl;

    





}
// Slower C++ solution:
#include <algorithm>

#include <cassert>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <vector>



#include <limits.h>



using namespace std;



typedef long long ll;



template<class T>

inline bool chmax(T &a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

inline bool chmin(T &a, T b) {

    if(a > b) {

        a = b;

        return true;

    }

    return false;

}



const int INF = INT_MAX / 2;



int main(void) {

    int A, B, C, X, Y;

    cin >> A >> B >> C >> X >> Y;



    int ans = INF;

    for (int num_c = 0; num_c <= 200000; num_c += 2) {

        int num_a = max(0, X - num_c / 2);

        int num_b = max(0, Y - num_c / 2);

        int cand = num_a * A + num_b * B + C * num_c;

        chmin(ans, cand);

    }



    cout << ans << endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.47905341416479x):
#include <algorithm>

#include <cassert>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <vector>



#include <limits.h>



using namespace std;



typedef long long ll;



template<class T>

inline bool chmax(T &a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

inline bool chmin(T &a, T b) {

    if(a > b) {

        a = b;

        return true;

    }

    return false;

}



const int INF = INT_MAX / 2;



int main(void) {

    int A, B, C, X, Y;

    cin >> A >> B >> C >> X >> Y;



    int ans = INF;



    // buy only A and B pizza

    chmin(ans, A * X + B * Y);



    // buy only C pizza

    chmin(ans, max(X, Y) * 2 * C);



    // buy A, B, and C pizza

    if (X < Y) {

        int acc = 2 * C * X;

        acc += (Y - X) * B;

        chmin(ans, acc);

    } else {

        int acc = 2 * C * Y;

        acc += (X - Y) * A;

        chmin(ans, acc);

    }



    cout << ans << endl;



    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <math.h>

using namespace std;



int main() {

    int A, B, C, X, Y;

    cin >> A >> B >> C >> X >> Y;

    int min_cost = 2 * 5000 * 100000;

    for (int num_C = 0; num_C / 2 <= 100000; num_C++) {

        int num_A = 0, num_B = 0;

        if (num_C / 2 < X) {

            num_A = X - num_C / 2;

        }

        if (num_C / 2 < Y) {

            num_B = Y - num_C / 2;

        }

        int sum = A * num_A + B * num_B + C * num_C;

        min_cost = fmin(min_cost, sum);

    }

    cout << min_cost << endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.9758990675921797x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



// マクロ

// forループ

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

#define REPD(i,n) for(ll i=n-1;i>=0;i--)

#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)

#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)

// xにはvectorなどのコンテナ

#define ALL(x) (x)begin(),(x).end()

#define SIZE(x) ((ll)(x).size())

#define MAX(x) *max_element(ALL(x))

#define MIN(x) *min_element(ALL(x))

// 出力

#define PRINT(x) cout<<(x)<<endl

#define PRINTA(x,n) REP(i,n)PRINT(x[i])

// 定数

#define INF 1000000000000 // 10^12

#define MOD 1000000007 // 10^9+7

// 略記

#define PB push_back

#define MP make_pair



int A, B, C, X, Y;



int main() {

    cin >> A >> B >> C >> X >> Y;

    int min_cost = 0;

    if (A + B < 2 * C) {

        min_cost += A * X + B * Y;

    }

    else if (X < Y) {

        min_cost += 2 * C * X;

        if (B < 2 * C) {

            min_cost += B * (Y - X);

        }

        else {

            min_cost += 2 * C * (Y - X);

        }

    }

    else {

        min_cost += 2 * C * Y;

        if (A < 2 * C) {

            min_cost += A * (X - Y);

        }

        else {

            min_cost += 2 * C * (X - Y);

        }

    }

    PRINT(min_cost);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



#define FOR(i,a,b) for(int i = (a); i < (b); ++i)

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

#define all(x) (x).begin(),(x).end()



inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}



typedef long long ll;



const int maxi = 1e5;

 

int main(){

    int A, B, C, X, Y;

    cin >> A >> B >> C >> X >> Y;



    int ans = 1e9;

    for(int i = 0; i <= maxi; i++){

        ans = min(ans, i*2*C + max(0, X-i)*A + max(0, Y-i) * B);

    }



    cout << ans << endl;





    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3217607140312426x):
#include <bits/stdc++.h>



using namespace std;



typedef long long llint;



int main() {

  int a, b, c, x, y;

  cin >> a >> b >> c >> x >> y;

  int ans = 0;

  if (c * 2 < a + b) {

    int m = min(x, y);

    x -= m, y -= m;

    ans += 2 * c * m;

  }

  if (c * 2 < a) {

    ans += 2 * c * x;

    x = 0;

  }

  if (c * 2 < b) {

    ans += 2 * c * y;

    y = 0;

  }

  ans += a * x + b * y;

  cout << ans << endl;



  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int a,b,c,x,y;

	cin>>a>>b>>c>>x>>y;

	

	vector<long long> dp((int)1e5+1);

	for(int i=0;i<=(int)1e5;i++)

	{

		dp[i] = max(0,x-i)*a + max(0,y-i)*b + i*2*c*1LL;

	}

	cout<<*min_element(dp.begin(),dp.end());

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.194629412493459x):
#include<bits/stdc++.h>

typedef long long int lli;

using namespace std;

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int a,b,c,min,max,minc,maxc;

    lli cost1,cost,x,y;

    cin>>a>>b>>c>>x>>y;

    

    if(x<y){

        min=x;

        max=y;

        minc=a;

        maxc=b;

    }

    else{

        min=y;

        max=x;

        minc=b;

        maxc=a;

        

    }

    

    

     if(2*c*max <= 2*c*min+(max-min)*maxc){

            cost1=2*c*max;

        } 

        else 

        cost1=2*c*min+(max-min)*maxc;

        if(max*maxc+min*minc <= cost1)

            cost=max*maxc+min*minc;

        else cost=cost1;

        

        cout<<cost;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int a,b,c,x,y;

	cin>>a>>b>>c>>x>>y;

	

	vector<long long> dp((int)1e5+1);

	for(int i=0;i<=(int)1e5;i++)

	{

		dp[i] = max(0,x-i)*a + max(0,y-i)*b + i*2*c*1LL;

	}

	cout<<*min_element(dp.begin(),dp.end());

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2356079483218396x):
#include <cstring>

#include <cstdlib>

#include <ctime>



#include <iostream>

#include <vector>

#include <set>

#include <string>

#include <map>

#include <queue>

#include <stack>

#include <algorithm>

const int INF=0x3fffffff;

using namespace std;



int main()

{

	int A, B, C, x, y;

	cin >> A >> B >> C >> x >> y;



	if (C * 2 >= A + B)

	{

		printf("%d", x * A + y * B);

		return 0;

	}



	int cCount, aCount;

	aCount = cCount = 0;

	if (x < y)	//保持x需求大

	{

		swap(x, y);

		swap(A, B);

	}

	

	cCount = y*2;

	x -= y;

	if (C * 2 > A) {

		aCount = x;

		printf("%d\n", cCount * C + aCount * A);

	}

	else

	{

		cCount += 2 * x;

		printf("%d\n", cCount * C);

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int a,b,c,x,y;

	cin>>a>>b>>c>>x>>y;

	

	vector<long long> dp((int)1e5+1);

	for(int i=0;i<=(int)1e5;i++)

	{

		dp[i] = max(0,x-i)*a + max(0,y-i)*b + i*2*c*1LL;

	}

	cout<<*min_element(dp.begin(),dp.end());

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.254980767214488x):
#include <iostream>

using namespace std;

int main()

{

    int a, b, c, x, y, com, ext,tot=0;

    scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);

    if (y > x)

    {

        int t = x;

        x = y;

        y = t;

        t = a;

        a = b;

        b = t;

    }

    com=y;ext=x-y;

    if(2*c<a+b)tot+=com*c*2;else tot+=com*(a+b);

    if(2*c<a)tot+=ext*2*c;else tot+=ext*a;\

    printf("%d",tot);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int a,b,c,x,y;

	cin>>a>>b>>c>>x>>y;

	

	vector<long long> dp((int)1e5+1);

	for(int i=0;i<=(int)1e5;i++)

	{

		dp[i] = max(0,x-i)*a + max(0,y-i)*b + i*2*c*1LL;

	}

	cout<<*min_element(dp.begin(),dp.end());

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2260940438734x):
#include<iostream>

#include<cstdio>



using namespace std;



int main() {

	int a, b, c, x, y;

	cin >> a >> b >> c >> x >> y;

	int money = 0;

	if (c <= (a + b) / 2) {

		if (x <= y) {

			money = 2 * c * x + (y - x) * b;

			if (money > 2 * c * y) money = 2 * c * y;

		}

		else {

			money = 2 * c * y + (x - y) * a;

			if (money > 2 * c * x) money = 2 * c * x;

		}

	}

	else {

		money = a * x + b * y;

	}

	cout << money << endl;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int a,b,c,x,y;

	cin>>a>>b>>c>>x>>y;

	

	vector<long long> dp((int)1e5+1);

	for(int i=0;i<=(int)1e5;i++)

	{

		dp[i] = max(0,x-i)*a + max(0,y-i)*b + i*2*c*1LL;

	}

	cout<<*min_element(dp.begin(),dp.end());

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2274695516376104x):
#include<bits/stdc++.h>

using namespace std;

main()

{

    long long  a,b,c,x,y,z,d,m1,m2,m3;

    cin>>a>>b>>c>>x>>y;

    z=min(x,y);

    if(x>y)d=(x-y)*a;

    else d=(y-x)*b;

    m2=d+(z*2*c);

    m3=max(x,y)*2*c;



    m1=a*x + b*y;

    m1=min(m1,m2);

    m1=min(m1,m3);

    cout<<m1<<endl;



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int a,b,c,x,y;

	cin>>a>>b>>c>>x>>y;

	

	vector<long long> dp((int)1e5+1);

	for(int i=0;i<=(int)1e5;i++)

	{

		dp[i] = max(0,x-i)*a + max(0,y-i)*b + i*2*c*1LL;

	}

	cout<<*min_element(dp.begin(),dp.end());

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.2257264174647666x):
#include <bits/stdc++.h>



using namespace std;



int main() {

    int a, b, c, x, y;

    cin >> a >> b >> c >> x >> y;

    int answer;

    if (a <= c && b <= c) {

        answer = a * x + b * y;

    } else if (a > c && b > c) {

        if (x >= y) {

            answer = c * 2 * y + min(a * (x - y), c * 2 * (x - y));

        } else {

            answer = c * 2 * x + min(b * (y - x), c * 2 * (y - x));

        }

    } else if (a > c && b <= c) {

        if ((a + b) >= 2 * c) {

            if (x >= y) {

                answer = c * 2 * y + min(a * (x - y), c * 2 * (x - y));

            } else {

                answer = c * 2 * x + b * (y - x);

            }

        } else {

            if (x >= y) {

                answer = a * y + b * y + min(a * (x - y), c * 2 * (x - y));

            } else {

                answer = a * x + b * y;

            }

        }

    } else if (a <= c && b > c) {

        if ((a + b) >= 2 * c) {

            if (x >= y) {

                answer = c * 2 * y + a * (x - y);

            } else {

                answer = c * 2 * x + min(b * (y - x), c * 2 * (y - x));

            }

        } else {

            if (x >= y) {

                answer = a * x + b * y;

            } else {

                answer = a * x + b * x + min(a * (y - x), c * 2 * (y - x));

            }

        }

    }

    cout << answer << endl;

}
// Slower C++ solution:
using namespace std;

#include <iostream>

#include <string>

#include <cstdio>

#include <algorithm>

#include <vector>

#include <climits>

#define all(x) (x).begin(),(x).end()



void solve(){



}

int main(){

    int a,b,c,x,y;

    cin >> a >> b >> c >> x >> y;



    int adda, addb, sum;

    int minp = INT_MAX;

    for (int i = 0; i <= 100000; i++){

        minp = min(i * 2 * c + max(0,x-i) * a + max(0,y-i) * b, minp);

    }



    cout << minp << endl;







}


// Faster C++ solution for the same problem (measured speedup: 1.3217828449944342x):
using namespace std;

#include <iostream>

#include <string>

#include <cstdio>

#include <algorithm>

#include <vector>

#include <cmath>

#include <functional>

#include <cassert>

#define all(x) (x).begin(),(x).end()



void solve(){



}

int main(){

    int a,b,c,x,y;

    cin >> a >> b >> c >> x >> y;

 

    int simple_sum = x * a + y * b;

    int c_sum = max(x, y) * c * 2;

 

    int ab_amount;

    int a_amount;

    int b_amount;

 

    if (x < y){

 

        //int xquot = x / 2;

        //int yquot = y / 2;

 

        //int amod = x % 2;

        //int bmod = y - 2 * xquot;

        int bmod = y - x;



 

        ab_amount = c * x * 2;

        a_amount = a * 0;

        b_amount = b * bmod;

 

    } else {

 

        int amod = x - y;

 

        ab_amount = c * y * 2;

        a_amount = a * amod;

        b_amount = b * 0;

 

    }

    int opt_sum = ab_amount + a_amount + b_amount;

 

    cout << min(min(simple_sum, c_sum), opt_sum) << endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

/**

AHMED;HASSAN;SAEED

*/

using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    long long a,b,c,x,y;

    cin>>a>>b>>c>>x>>y;

    long long mn=min(x,y);

    long long ans1=0;

    long long ans2=0;

    if(x*a+y*b>=mn*2*c){

        ans1+=mn*c*2;

        if(x>y){

            long long sn=x-y;

            ans1+=min(sn*a,sn*2*c);

        }

        else{

            long long sn=y-x;

            ans1+=min(sn*b,sn*2*c);

        }

    }

    ans2+=x*a+y*b;

    if(ans1!=0)

    cout << min(ans1,ans2) << endl;

    else

    cout << ans2 << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.31012163794956x):
#include<stdio.h>

#include<algorithm>

using namespace std;



int a,b,c,x,y;



int main(){

//	freopen("inb.txt","r",stdin);

	scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);

	int com = min(x,y);//a b棋盘公共的部分 com套a+b 

	int sum = 0; 

	if(a+b>=c*2){//套装更优惠 

		sum += com*c*2; 

		if(x>=y){

			if(a>=c*2){

				sum += (x-y)*2*c;

			}else{

				sum += (x-y)*a;

			}	

		}else{

			if(b>=c*2){

				sum += (y-x)*2*c;

			}else{

				sum += (y-x)*b;

			}

		}

	}else{//单买更优惠 

		sum = x*a + y*b; 

	}

	printf("%d\n", sum);

	

	return 0;

}