#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define vl vector<ll>
#define pstr pair<string, string>
#define lli long long int
#define ll long long
#define ld long double
#define ull unsigned long long
#define sz size()
#define pb push_back
#define pob pop_back
#define pf push_front
#define ff first
#define ss second
#define F first
#define S second
#define mk make_pair
#define fr front()
#define PI 3.14159265358979323846
using namespace std;
const ll MOD = 1e9 + 7;
const ll N = 1e6 + 5;
const ll inf = 1e18;
const ll maxsize = 105;

ll binpow(ll a, ll b){
    if(b == 1) return a;
    ll z = binpow(a, b / 2);
    if(b % 2 == 0) return (z * z);
    else return (z * z) * a ;
}

ll binpow_m(ll a, ll b){
    if(b == 1) return a % MOD;
    ll z = binpow(a, b / 2);
    if(b % 2 == 0) return (z * z) % MOD;
    else return (z * z) % MOD * a % MOD;
}

ll lcm(ll a, ll b) {
    return (a / __gcd(a, b)) * b;
}

ll Prime(unsigned long a, unsigned long j){
   return j * j <= a ? (a % j) && Prime(a, j + 1) : 1;
}

bool isPrime(ll n){
    for(ll i = 2; i <= sqrt(n); i++){
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

int main(/*d!ZzAsTer?*/)
{
    boost;
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    ll n,m,s=0;
    cin>>n>>m;
    while(n>0||m>0){
        s+=n*m;
        if(n>=m){
            ll x=(m+1)*(m+2)/2-2;
            s+=x;
            n--;
        }else{
            ll x=(n+1)*(n+2)/2-2;
            s+=x;
            m--;
        }
    }
    cout<<s;
    return 0;
}
