#include <bits/stdc++.h>

#define fierce ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#define freop freopen(".in","r",stdin);freopen(".out","w",stdout);
#define mem(name, val) memset(name, val, sizeof(name))
#define all(x) x.begin(), x.end()
#define fix fixed << setprecision
#define rs(x) ((x) << 1 | 1)
#define ls(x) ((x) << 1)
#define int long long
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define sz(x) x.size()

const int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 1e9 + 7;
const long double eps = 1e-11;
const int MOD = 1e6;
const int N = 2e5 + 70;
const int M = 1e7 + 7;
const int LOG = 20;
const int ONE = 0;

using namespace std;

void init(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif                      
}

int gcd(int a, int b){
    while(a and b){
        if(a>b)
            a %= b;
        else
            b %= a;
    }return a+b;
}

int T = 1, cs = 1, h, w;

int rec(int h, int w){
    if(w != 1){
        return rec(h, w - 1) + rec(h, 1) + h * w;
    }else if(h != 1){
        return rec(h - 1, w) + rec(1, w) + h * w;
    }
    return 1;
}

void test(){
    cin >> h >> w;
    if(h < w){
        swap(w, h);
    }
    int ans = (h * (h + 1)) / 2 + (h - 1);
    if(w == 1){
        cout << ans;
        return;
    }else if(w == 2){
        cout << w * h + (w * ans);
        return;
    }else{
        int ans2 = 0;
        for(int i = 2; i < w; i++){
            ans2 += i * h;
        }cout << w * h + (w * ans) + ans2 << endl;
    }
}

signed main(){
    fierce
    // init();
    // freop
   	// cin >> T;
    while(T--){
        test();
    }
}