#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#define int long long
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    int n,m;
    cin>>n>>m;
    if(n>m){
        swap(n,m);
    }
    int ans=n*m;
    while(m>1){
        ans+=n*(m-1) + (n*(n+1))/2+n-1;
        m--;
    }
    ans+=n*(n-1)/2+n-1;
    cout<<ans;
}