#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
typedef long long ll;
typedef long double ld;
using namespace std;
#define ff first
#define ss second
#define gigachad 1e9+7.0
int main() {
    ll h,w;
    cin>>h>>w;
    ll ans=h*w;
    if(h == 1 || w == 1){
        cout<<(max(w,h)+1)*(max(h,w)+2)/2-2;
        return 0;
    }
    while(h*w!=1){
        if(h == 1){
            ans+=(w+1)*(w+2)/2 - 2 - w * h;
            break;
        }
        else if(w==1){
            ans+=(h+1)*(h+2)/2 - 2 - w * h;
            break;
        }
        if(h > w){
            ans += (w+1)*(w+2)/2 - 2 + (w * (h - 1));
            h--;
        }
        else{
            ans += (h+1)*(h+2)/2 - 2 + (h * (w - 1));
            w--;
        }
    }
    cout<<ans;
    return 0;
}
