#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <iterator>
using namespace std;

#define ll long long


#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back
ll sum;
ll gcd(ll a, ll b) {
    if (a < b)
        return gcd(b, a);

    if (b == 0)
        return a;

    return gcd(b, a % b);



}
ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}
ll binpow(ll x, ll y) {
    ll g = 1;
    while (y) {
        if (y % 2) {
            g *= x;
        }
        x *= x;
        y /= 2;
    }
    return g;
}
bool koren(int n)
{
    int odd = 1;
    while (n > 0)
    {
        n = n - odd;
        odd = odd + 2;
    }
    return n == 0;
}
int pere(int n){
    sum = 0;
    while(n > 0){
        sum = sum * 10 + n % 10;
        n /= 10;
    }
    return sum;
}
int cnt = 0;
bool was[1000009];
int a[105];
map<pair<int,int> , ll>ma;
ll func(ll n, ll m){
    ll ans = 0;
    if(n == 1 && m == 1)
        ans = 1;
    else if (ma.count(make_pair(n, m)))
        ans = ma[mp(n, m)];
    else if (n == m)
        ans = n * m + func(n - 1, m) + func(1, n);
    else if (n < m) {
         ans = n * m + func(n, m - 1) + func(1 , n);
    } else
         ans = n * m + func(m, n - 1) + func(1 , m);
    ma[mp(n, m)] = ans;
    ma[mp(m, n)] = ans;
    return ans;
}
int main()
{
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
    ll n , m;
    cin >> n >> m;
    cout << func(n , m);
    
}
