#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  long long n;
  cin >> n;
  long long m;
  cin >> m;
  long long ar = n * m;
  if (n > m) swap(n, m);
  long long r = 0;
  if (n == 1) {
    m %= 6;
    if (m > 3) m = 6 - m;
    r = m;
  } else if (n == 2) {
    if (m == 2)
      r = 4;
    else if (m == 3)
      r = 2;
    else if (m == 7)
      r = 2;
    else
      r = 0;
  } else if ((m * n) & 1) {
    r = 1;
  } else
    r = 0;
  cout << (ar - r);
}
