#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>

using namespace std;

#define double long double

unsigned long long n, m, ch = 0, k = 0;
unsigned long long sum;

signed main()
{
    cin >> n >> m;
    if(n < m)
        swap(n, m);
    for(int i = 0; i < m; i++) {
        if(i >= 2)
            k++;
        ch += m - k;
    }
    while(n != 1) {
        sum += n * m;
        n--;
        sum += ch;
    }
    cout << sum + ch;
    return 0;
}

