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