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