#include <iostream>
#include <queue>
using namespace std;
unsigned long long num[100000+1];
class info{
public:
unsigned long long Ph,Bi;
info(){Bi=Ph=0;};
info(const unsigned long long& O1,const unsigned long long& O2){Ph=O1;Bi=O2;};
};
class sort_by_Ph{
public:
bool operator()(const info& L, const info& R){
return L.Ph<=R.Ph;
};
};
priority_queue<info,vector<info>,sort_by_Ph> Phy;
class sort_by_Bi{
public:
bool operator()(const info&L, const info& R){
return L.Bi<= R.Bi;
};
};
priority_queue<info,vector<info>,sort_by_Bi> Bio;
int main(){
unsigned long long n,a,b,B,P;
unsigned long long ans=0;
cin >> n >> a >> b;
for(unsigned long long i = 1; i <= n; i++){
cin >> num[i];
}
for(unsigned long long i = 1; i <= n; i++){
P=num[i];
cin >> B;
if (b == 0) {
Phy.push(info(P, B));
continue;
}
if (a == 0) {
Bio.push(info(P, B));
continue;
}
if(B >= P){
if(Bio.size() == b){
if(B >= Bio.top().Bi){
Phy.push(Bio.top());
Bio.pop();
Bio.push(info(P,B));
}
else{
Phy.push(info(P,B));
}
}
else{
Bio.push(info(P,B));
}
}
else{
if(Phy.size() == a){
if(P >= Phy.top().Ph){
Bio.push(Phy.top());
Phy.pop();
Phy.push(info(P,B));
}
else{
Bio.push(info(P,B));
}
}
else{
Phy.push(info(P,B));
}
}
}
while(!Bio.empty()){
ans += Bio.top().Bi;
Bio.pop();
}
while(!Phy.empty()){
ans += Phy.top().Ph;
Phy.pop();
}
cout << ans;
}