#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> z = {
    {0, 0, 0, 0, 0, 0, 0, 0},       {0, 0, 0, 0, 2, 4, 6, 6},
    {0, 0, 0, 4, 8, 10, 12, 12},    {0, 0, 4, 8, 12, 14, 18, 20},
    {0, 2, 8, 12, 16, 20, 24, 28},  {0, 4, 10, 14, 20, 24, 30, 34},
    {0, 6, 12, 18, 24, 30, 36, 42}, {0, 6, 12, 20, 28, 34, 42, 48}};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long x, y;
  cin >> x >> y;
  if (x > y) swap(x, y);
  long long res = 0;
  if (x == 1) {
    cout << (y / 6) * 6 + z[1][y % 6];
  } else if (y <= 7) {
    cout << z[x][y] << endl;
  } else {
    cout << ((x * y) & ~1ll) << endl;
  }
}
