#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m, n;
  cin >> n >> m;
  if (n > m) swap(m, n);
  if (n == 1)
    cout << m / 6 * 6 + max(m % 6 - 3, 0) * 2 << endl;
  else if (n == 2)
    cout << (m == 2 ? 0 : m == 3 ? 4 : m == 7 ? 12 : m << 1) << endl;
  else
    cout << (m * 1ll * n) / 2 * 2 << endl;
}
