#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double ld;

#define all(x) x.begin(),x.end()
#define pb push_back
#define ent "\n"

const int maxn = (int)1e6 + 13;
const ll inf = (long long)1e18 + 20;
const int mod = (int)1e9 + 7;
int res[maxn];
ll get(int x,int y){
    if(x == 1 || y == 1){
        return res[max(x,y)];
    }
    else{
        ll ans = 0;
        if(x >= y){
            ans = get(x - 1,y) + get(1,y);
        }
        else{
            ans = get(x,y - 1) + get(x,1);
        }
        return (ans + (x * y));
    }
}
void solve(){
    res[1] = 1;
    int h,w;cin >> h >> w;
    for(int i = 2;i <= max(h,w);i++){
        res[i] = (res[i - 1] + (i + 1));
    }
    ll ans = get(h,w);
    cout << ans;
}

int main(){
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 int t = 1;
 //cin >> t;
 while(t --){
  solve();
 }
 return 0;
}
