#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;

int main() {
  ll N,A,B,C;
  cin>>N>>A>>B>>C;
  sort<A,A+N,greater<int>());
  int ans=0;
  for(int i=0;i<N;i++){
    ans+=B[i];
    if(A[i]+1==A[i+1]){
      ans+=C[i];
    }
  }
  cout<<ans<<endl;
}
    
