#include <bits/stdc++.h>
#define int long long
using namespace std;


signed main() {
    int n,m;
    cin>>n>>m;
    if(n==1){
        cout<<m*((m+2)/2);
    }
    else if(m==1){
        cout<<n*((n+2)/2);
    }
    else{
        cout<<max((n*n*m+2*m),(m*m*n+2*n));
    }
}
