#include<bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
using namespace std;
#define int long long
#define y1 cheza
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N=2e5+1000;
const int M=1e4;
const int mod=1e9+7;
const int INF=1e18;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};
const long double eps=1e-6;
int n,m;
int ans=0;
map<pair<int,int>,int>dp;
int calc(int r){
    if(r==1)return 1;
    if(r==2)return 4;
    int res=(r+1)*(r+2)/2-2;
    return res;
}
void test(){
    cin>>n>>m;
    int ans=0;
    while(n!=0||m!=0){
        if(n<m)swap(n,m);
        ans+=n*m;
        n--;
        ans+=calc(m);
    }
    cout<<ans<<'\n';
}


/*
1=1
2=4
4
3=8
5
4=13
6
5=19
6=26
*/

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout.tie(nullptr);
    long long t2=1;
    //  cin>>t2;
    for(int i=1;i<=t2;i++){
        test();
    }
    
    return 0;

}

