#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <deque>
#include <ctime>
#include <random>

#define int long long
#define ld long double
#define endl '\n'
#define fi first
#define se second
#define p_b push_back

using namespace std;

const int inf = 1e9 + 7;

main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int h,w;
    cin>>h>>w;
    int ans=0;
    while(h>1&&w>1)
    {
        int v1=(h-1)*w,v2=(w-1)*h;
        ans+=h*w;
        if(v1>v2)
        {
            ans+=w*(w+1)/2+w-1;
            h--;
        }
        else
        {
            ans+=h*(h+1)/2+h-1;
            w--;
        }
    }
    if(h>1)
    {
        ans+=h*(h+1)/2+h-1;
    }
    else if(w>1)
    {
        ans+=w*(w+1)/2+w-1;
    }
    else ans++;
    cout<<ans;
    return 0;
}
