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