#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  long long ans = 0;
  if (a == 1) {
    int m = b % 6;
    ans = b / 6 * 6;
    if (m < 3) m = 3;
    ans += (m - 3) * 2;
  } else if (a == 2) {
    if (b == 2) {
      ans = 0;
    } else if (b == 3) {
      ans = 4;
    } else if (b == 7) {
      ans = 12;
    } else {
      ans = b * 2;
    }
  } else if (a == 3) {
    if (b & 1) {
      ans = a * b - 1;
    } else {
      ans = a * b;
    }
  } else {
    ans = a * b / 2 * 2;
  }
  cout << ans << endl;
  return 0;
}
