#include <algorithm>
#include <cmath>
#include <vector>
#include <iostream>
using namespace std;

void Straza()
{
	int n, m;
	cin >> n >> m;
	int str = 0;

	//spoljasnji omotac
	str += n  * 2;
	str += (m - 2) * 2;
	cout << str << endl;
	//unutrasnja tabela
	int uy = n - 2;
	int pr2 = 0;
	int pr1 = 0;
	
	if (m % 2 == 0){
		pr1 = (m-2) / 2;
		pr2 = (m-2) / 2;
	}
	else {
		pr1 = (m-2) / 2;
		pr2 = pr1 + 1;
	}
	for (int i = 0; i < uy; i++)
	{
		if (i % 2 == 1)
			str += pr2;
		else
			str += pr1;
	}

	cout << str;

	
	
}


int main()
{
	Straza();
	return 0;
}