#include using namespace std; struct Mast{ int n; int w; vector y; int &operator[](int i){ return y[i]; } int const &operator[](int i) const{ return y[i]; } int64_t area() const{ return w*(int64_t)w; } void read(){ cin>>n>>w; y.resize(n); for (auto &i: y) cin>>i; sort(y.begin(),y.end()); } }; int gap; bool overlap(pair a,pair b){ if (a.firstgap; } int64_t solve(Mast const &a,Mast const &b){ int64_t res=0; int64_t last_res=0; vector dp(b.n,0); vector allowed(b.n,true); for (int i=0; i>gap; Mast a,b,c; a.read(); b.read(); c.read(); int64_t best=0; for (int64_t mask=(1llu<<(int64_t)b.n); mask--;){ Mast m={0,b.w,{}}; for (int64_t i=0; i