#include <stdio.h>

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <random>
#include <chrono>
#include <queue>
#include <functional>
#include <iostream>
#include <queue>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double

const ll maxn = 1e6 + 1, maxm = 1e7 + 1;
const ll mod = 1500000059, mod2 = 998244353, inf = 1e9, block = 550, hb = 1000012337, base = 1000050017;
const ld eps = 1e-3;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll n, m;
    cin >> n >> m;
    if(n < m) swap(n, m);
    ll ans = 0;
    ll dp[m + 1];
    dp[1] = 1ll * (n + 1) * (n + 2) / 2 - 2;
    for(int x = 2; x <= m; ++x){
        dp[x] = 1ll * n * x + 1ll * 2 * dp[x - 1];
    }
    cout << dp[m];
}













