#include <bits/stdc++.h>

#define mp make_pair
#define ull unsigned long long
#define ll long long
#define forn(i, n) for(int i = 0; i < n; i++)
using namespace std;


int rec(int a, int b) {
    if (a == 1 && b == 1) return 1;
    if (a == b) return rec(a - 1, b) + rec(1, b) + a * b;
    int mn = min(a, b);
    int mx = max(a, b);
    return rec(mn, mn) + rec(mn, mx - mn) + a * b;
}

void start() {
    int h, w;
    cin >> h >> w;
    cout << rec(h, w) << "\n";
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--)
        start();
}