#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (n > m) swap(n, m);
  switch (n) {
    case 1:
      cout << m / 6 * 6 + 2 * max(m % 6 - 3, 0);
      break;
    case 2:
      switch (m) {
        case 2:
          cout << 0;
          break;
        case 3:
          cout << 4;
          break;
        case 7:
          cout << 12;
          break;
        default:
          cout << 2 * m;
          break;
      }
      break;
    default:
      cout << 1ll * n * m / 2 * 2;
      break;
  }
  return 0;
}
