void solve() {
    int n, m;
    cin >> n >> m;
    ll answer = 0;
    int mn = -1;
    while (n > 1 || m > 1) {
        mn = min(n, m);
        answer += n * m;
        answer += ((mn + 1) * mn) / 2 + (mn - 1);
        if (n > m) n--;
        else m--;
        }
    
    cout << answer + 1  << "\n";
}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
