#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define int long long
#define ll long long
#define con continue
#define fir first
#define sec second
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define rev reverse
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define endl "\n"
using namespace std;
main()
{
    FAST
    int n,m;
    cin>>n>>m;
    if(n==1 && m==1)
        cout<<1;
    else if(min(n, m)==1 && max(n, m)==2)
        cout<<4;
    else if(n==2 && m==2)
            cout<<12;
    else
    {
        int k2=n*m,k=n*m,k1=n*m-max(n,m);
        while(k2--)
        {
            k+=k1;
        }
        cout<<k-min(n,m);
    }
}
