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