#include <bits/stdc++.h>
#include <set>
#include <map>
#include <vector>
#include <cmath>
using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define WHAT ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define cin(x, N) for(int i = 1; i <= N; i ++) cin >> x[i]
#define reset(x, N) for(int i = 1; i <= N; i ++) x[i] = 0;
#define sortvec(x) sort(x.begin(), x.end())
#define open_file(intput, output) freopen("input","r",stdin);freopen("output","w",stdout)
char a[12][12];
int main(){
    WHAT
    ll ans, N, M;
    cin >> N >> M;
    ans = N * M + (N - 1) * M;
    if(N == 1 && M == 1){
	cout << 1;
	exit(0);
    }
if(N > M) swap(N, M);
    if(N == 1){
        ans = N * M + (M - 1) * N;
	    for(int i = 1; i < M; i ++) ans += N * (M - i);
    }
    else{
        for(int i = 0; i < M; i ++){ 
            ans += N * (M - i);
        }
    }
    cout << ans;
}