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