#include <bits/stdc++.h>
#define int long long
#define ll long long
#define str string
#define ld long double
#define run_vasya_run ios_base::sync_with_stdio(0) , cin.tie(0) ,cout.tie(0)
#define uint unsigned long long
#define fi first
#define se second
#define pb push_back
#define open freopen ("log.in", "r", stdin);
#define close freopen("log.out", "w", stdout);
using namespace std;
const int MOD = 10000000007;
ll _;
main()
{
    //run_vasya_run;
    _ = 1;
    //open;
    //close;
    //cin >> _;
    while(_ --)
    {
        ll n, m, s=0;
        cin >> n >> m;
        if(n == 1 or m == 1)
        {
            cout << max(n, m) * (max(n, m) + 1) / 2 + max(n, m) - 1;
            return 0;
        }
        if(m > n){
            swap(n, m);
        }
        for (ll i = 2; i <= n; i++)
        {
            s += i * m;
        }
        cout << s + n * m + n * m;
    }
}
