#include <bits/stdc++.h>
using namespace std;
#define mod (int)(1e9+7)
#define num 100007
#define ll long long int
#define endl '\n'
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test0   ;
#define test1 int t;cin>>t;for(int i=1;i<=t;i++)
#define test2 int t;cin>>t;for(int i=1;i<=t;i++) cout<<"Case #"<<i<<": ",
#define F first
#define S second
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
void solve();
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    IOS

    test0
    solve();
}
/******************************************************/

void solve(){
    int a,b,x,y;
    cin>>a>>b>>x>>y; 
    
    int op1 =  abs(a-b)*y+x;
    int op2 = abs(a-b)*2*x+x;
    if(b<a){
        op2-=2*x;
        op1=(a-1-b)*y+x;
    }
    cout<<min(op1,op2)<<endl;
}
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n),b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];

  vector<ll> v[2];
  rep(i,n) v[i%2].emplace_back(b[i]-a[i]);
  sort(v[0].rbegin(),v[0].rend());
  sort(v[1].rbegin(),v[1].rend());
  ll ans = 0;
  rep(i,n) ans += a[i];
  rep(i,n>>1) ans += max(v[0][i]+v[1][i],0LL);
  cout << ans << endl;
}