#include <bits/stdc++.h>

using namespace std;
using ll = long long;

//map<pair<ll, ll>, ll> dp;
//
//
//ll f(ll a, ll b) {
////    if (dp.size() > 100) {
////        cout << "1";
////    }
//    if (a > b)
//        swap(a, b);
//    auto it = dp.find({a, b});
//    if (it != dp.end()) {
//        return it->second;
//    }
//
//    return dp[{a, b}] = f(a, b - 1) + f(a, 1) + a * b;
//}


signed main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);

    ll a, b;

    cin >> a >> b;

    if(a > b)
            swap(a, b);

    if(a == 1)
        cout << a * b + a * ((b - 1) * (b + 2) / 2);
    else
        cout << a * b + a * ((b - 1) * (b + 2) / 2) + b * ((a - 1) * (a + 2) / 2);

}