#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ioigold ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define nl '\n'
#define sz(s) (int)s.size()
#define pb push_back   
#define con continue
#define S second
#define F first

using namespace std;

const int N = (int)3e5 + 7;
const int inF = (int)-1e9 - 7;
const int INF = (int)1e18 + 7;                                                  
const int mod = 1e9 + 7;

int ans = 0;

void f(int n, int m){
    int mn = min(n , m), mx = max(n, m);
    int kk = (mx * 1ll * (mx + 1))/2, kk2 = ((mn - 1) * (max(mn - 2, 0ll)))/2;
    int kj = kk - kk2;
    kj *= mn;
	ans += kj;
    if(n <= 1 && m <= 1){
        return;
    }
	if(n < m){
	    ans += ((m * 1ll * (m + 1)) / 2) + (m - 1);
	    f(n - 1, n - 1);
	}
	else{
	    ans += ((n * 1ll * (n + 1)) / 2) + (n - 1);
	    f(m - 1, m - 1);
	}
}

void solve(){
	int n, m;
	cin >> n >> m;

	f(n, m);

	cout << ans + 1;
}

main() {
	//freopen("complete.in", "r", stdin);
    //freopen("complete.out", "w", stdout);
	                                                                               
	ioigold                                             
	
    int T = 1;
    //cin >> T;

    while(T--){                                                     
    	solve();
    }
}