#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n, m;
    cin>>n>>m;
    int mn = min(n, m);
    int mx = max(n, m);
    unsigned long long ans = n * m * 2;
    if(n == 1 && m == 1){
        cout << 1;
        return 0;
    }
    if(mn == 1){
        int i = 1;
        while(mx > i + 1){
            ans += mn * (mx - i);
            i++;
        }
        cout << ans;
        return 0;
    }
    if(mn == 2){
        int i = 0;
        while(mx > i + 1){
            ans += mn * (mx - i);
            i++;
        }
        cout << ans;
        return 0;
    }
    int cnt = mn;
    int i = 1;
    while(mn > i + 1){
        cnt += (mn - i);
        i++;
    }
    ans += cnt * mx;
    int j = 0;
    while(mx > j){
        ans += mn * (mx - j);
        j++;
    }
    cout << ans;
}
