#include <bits/stdc++.h>
using namespace std;
int c[14] = {0, 0, 0, 0, 2, 4, 6, 6, 6, 6, 8, 10, 12};
int main() {
  int n, m;
  cin >> n >> m;
  if (n > m) swap(n, m);
  long long ans = (1LL * n * m);
  if (ans & 1) ans--;
  if (n == 1) {
    if (m <= 12)
      ans = c[m];
    else {
      int d = m / 6 - 2;
      d *= 6;
      ans = c[12] + d;
      if (m % 6 > 3) ans += (m % 6 - 3) * 2;
    }
  } else if (n == 2 && m == 7)
    ans = 12;
  else if (n == 2 && m == 2)
    ans = 0;
  else if (n == 2 && m == 3)
    ans = 4;
  cout << ans << endl;
  return 0;
}
