#include <bits/stdc++.h>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <string> 
 
#define pb push_back
#define ll long long
#define f first
#define s second

const ll int INF = 1e18, inf = 1e9, mod = 1e9 + 7;


using namespace std;

ll int rec(int n, int m) {
	if (n == 1) {
		if (m == 1)
			return 1;
		return rec(1, m - 1) + 1 + m * n;
	}

	return rec(max(m, n) - 1, min(m, n)) + rec(1, min(m, n)) + m * n;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m, k;
	cin>>n>>m;

	cout<<rec(max(m, n) - 1, min(m, n)) + rec(1, min(m, n)) + m * n;
}
