#include <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>

using namespace std;

// #define int long long
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

#define endl '\n'
ll n, m;
map<pii, ll> mp;
ll dfs(int cur_n, int cur_m)
{
    if(cur_n == 0 or cur_m == 0)
        return 0;

    if (cur_n > cur_m)
        swap(cur_n, cur_m);
    assert(cur_n <= cur_m);

    if(mp.find({cur_n, cur_m}) != mp.end())
        return mp[{cur_n, cur_m}];

    ll ans = cur_n * 1ll * cur_m;
    ans += dfs(cur_n, cur_m - 1);
    // if(cur_n != 1)
        ans += dfs(1, cur_n);
    mp[{cur_n, cur_m}] = ans;
    // cout << cur_n << ' ' << cur_m << " = " << ans << endl;
    return ans;
}

void Algo(int test)
{

    cin >> n >> m;
    mp[{1, 1}] = 1;

    cout << dfs(n, m);
}

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cout << fixed;

    int tests = 1;
    for (int test = 1; test <= tests; test++)
    {
        Algo(test);
    }

    return 0;
}