#include #include #include #include #include #include #include using namespace std; map, int>dp; int solve(int w, int h, int dir) { if (dp.find(make_tuple(w, h, dir)) != dp.end())return dp[make_tuple(w, h, dir)]; int a, b; a = 2 * h + 1; b = 2 * w + 1; if (dir == 1)a--; else b--; if (h == 1 || w==0)return b; if (w == 1 || h==0)return a; int ans = max(a + solve(w - 2, h,1), b + solve(w, h - 2,0)); dp[make_tuple(w, h, dir)] = ans; return ans; } int main() { int W, H; cin >> W >> H; if (W == 0 && H == 0)cout << 0 << endl; else cout << max(solve(W,H,1), solve(W, H, 0)) << endl; return 0; }