#include using namespace std; int N,A[2000],B[2000]; bool use[2000]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N; for(int i=0;i<2*N;i++)cin>>A[i]; for(int i=0;i<2*N;i++)cin>>B[i]; map>mp; for(int i=0;i<2*N;i++)mp[A[i]+B[i]].push_back(i); long X=0,Y=0; int t=0; for(auto[sum,V]:mp) { while(V.size()) { if(t==0) { sort(V.begin(),V.end(),[&](int i, int j) { return A[i]>A[j]; }); X+=A[V.back()]; } else { sort(V.begin(),V.end(),[&](int i, int j) { return B[i]>B[j]; }); Y+=B[V.back()]; } V.pop_back(); t^=1; } } cout<