#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int n, m;
  cin >> n >> m;
  if (n < m) swap(m, n);
  if (m == 1) {
    long long int diff[] = {0, 0, 0, 0, 2, 4};
    cout << (n - (n % 6)) + diff[n % 6];
  } else if (m == 2) {
    if (n <= 2)
      cout << 0;
    else if (n == 3 || n == 7)
      cout << n * m - 2;
    else
      cout << n * m;
  } else
    cout << 2 * ((n * m) / 2);
  return 0;
}
