#include<bits/stdc++.h>

#define ll long long
#define int long long
#define pb push_back
#define mp make_pair
#define vec vector
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

using namespace std;

void solve1(){
    int n;
    cin >> n;
    int a[n], c[n];
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> c[i];
    vec < int > st;
    vec < int > l(n, -1);
    vec<int> r(n + 1, n + 1);
    for (int i = 0; i < n; ++i) {
        while (sz(st) && a[st.back()] < a[i])
            st.pop_back();
        if (sz(st))
            l[i] = st.back();
        st.push_back(i);
    }
    st.clear();
    for (int i = n - 1; i >= 0; i--) {

    }
}

void solve(){
    ll n,m;
    cin>>n>>m;
    if (n<m)swap(n,m);
    ll s1=1,s2;
    for (int i=2;i<=n;i++)
        s1 = s1+i+1;
        //cout<<s1<<endl;
    s2 = s1;
    for (int i=2;i<=m;i++)
        s2 = s2+s1+i*n;
    cout<<s2;
}

int32_t main () {
//    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
}
