#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
long long n, m;
int main() {
  while (cin >> n >> m) {
    if (n > m) swap(n, m);
    if (n == 1) {
      cout << m / 6 * 6 + max(m % 6 - 3, 0LL) * 2;
    } else if (n == 2 && m == 2) {
      cout << "0" << endl;
    } else if (n == 2 && m == 3) {
      cout << "4" << endl;
    } else if (n == 2 && m == 7) {
      cout << "12" << endl;
    } else {
      if (n * m % 2 == 0) {
        cout << n * m << endl;
      } else {
        cout << (n * m - 1) << endl;
      }
    }
  }
}
