#include <bits/stdc++.h>
using namespace std;
const long ka[6] = {0, 0, 0, 0, 2, 4};
int main() {
  long long n, m;
  while (cin >> n >> m) {
    if (n > m) {
      int tmp = n;
      n = m;
      m = tmp;
    }
    long long ret;
    if (n == 1)
      ret = m / 6 * 6 + ka[m % 6];
    else if (n == 2) {
      if (m == 2)
        ret = 0;
      else if (m == 3)
        ret = 4;
      else if (m == 7)
        ret = 12;
      else
        ret = n * m;
    } else {
      if (n % 2 && m % 2)
        ret = n * m - 1;
      else
        ret = n * m;
    }
    cout << ret << endl;
  }
  return 0;
}
