#include <bits/stdc++.h>
#define int long long
using namespace std;
main()
{
    // freopen("prices.in", "r", stdin);
    // freopen("prices.out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tests = 1;
//    cin >> tests;
    while (tests--){
        int n,m;
        cin>>n>>m;
        int m1 = min(n, m);
        n = max(n, m);
        int dp[n + 1];
        dp[1] = 1;
        for(int i = 2; i <= n; i++)
        {
            dp[i] = dp[i - 1] + i + 1;
        }
        int sh = 1;
        if(m1 == 1) sh--;
        cout << dp[n] * m1 + sh * n * m1;
    }
}
