#include <bits/stdc++.h>
using namespace std;
int a[4][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 4}, {0, 0, 4, 8}};
int main() {
  int n, m;
  cin >> n >> m;
  if (n < 4 && m < 4) {
    printf("%d\n", a[n][m]);
    return 0;
  }
  if (n > m) swap(n, m);
  if (n == 1) {
    int t = m % 6;
    if (t < 4)
      cout << m - t << endl;
    else
      cout << m - t + 2 * (t - 3) << endl;
    return 0;
  }
  if (n == 2) {
    int t = m % 4;
    if (t == 0)
      cout << 1ll * n * m << endl;
    else if (t == 1)
      cout << 1ll * n * m << endl;
    else if (t == 2)
      cout << 1ll * n * m << endl;
    else if (t == 3) {
      if (m < 11)
        cout << 1ll * n * m - 2 << endl;
      else
        cout << 1ll * n * m << endl;
    }
    return 0;
  }
  long long ans = 1ll * n * m;
  if (ans & 1) ans--;
  cout << ans << endl;
  return 0;
}
