#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>

#define ssort(arr) sort(arr.begin(), arr.end())

using namespace std;


using ll = long long;

const ll INF = 1e9;

ll f(ll n){
    return n + ((n * n) + n) / 2 - 1;
}

int main()
{
    ll n, m, O = 0;
    cin >> n >> m;
    if(n > m){
        swap(n, m);
    }

    ll k = m - n;
    O = n * m;
    for(int i = 1; i <= k; i++){
        O += n * m - n * i;
        O += f(n);
    }
    ll x = n, y = n;

    while(x > 1 || y > 1){
        if(y >= x){
            y--;
        }else{
            x--;
        }
        O += x * y + f(max(x, y));
    }





    cout << O;






    return 0;
}
