// 2009アジア地区予選 A : Cubist Artwork #include #include #include using namespace std; int main(){ ifstream fin("A.in"); int w, d, t; int h1[21], h2[21]; while(fin >> w >> d, w){ memset(h1, 0, sizeof(h1)); memset(h2, 0, sizeof(h2)); for(int i=0;i> t; h1[t]++; } for(int i=0;i> t; h2[t]++; } int ans = 0; for(int i=0;i<=20;i++){ ans += i*max(h1[i],h2[i]); } cout << ans << endl; } }