#include <bits/stdc++.h>
using namespace std;
string alpha = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);
const int N = 1e7 + 5;
long long int MOD = 1e9 + 7;
long long int OO = 1e18 + 8;
long long int pw(long long int b, long long int p) {
  if (!p) return 1;
  long long int sq = pw(b, p / 2);
  sq *= sq;
  if (p % 2) sq *= b;
  return sq;
}
long long int gcd(long long int a, long long int b) {
  return (b == 0 ? a : gcd(b, a % b));
}
long long int lcm(long long int a, long long int b) {
  return ((a * b) / gcd(a, b));
}
long long int PowMod(long long int bs, long long int ex, long long int M) {
  if (!ex) return 1;
  long long int p = PowMod((bs * bs) % M, ex >> 1, M);
  return (ex & 1) ? (p * bs) % M : p;
}
long long int ModInverse(long long int a) { return PowMod(a, MOD - 2, MOD); }
long long int ExtGCD(long long int a, long long int b, long long int& x,
                     long long int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return a;
  }
  long long int r = ExtGCD(b, a % b, y, x);
  y -= a / b * x;
  return r;
}
long long int mult(long long int a, long long int b) {
  return (1LL * a * b) % MOD;
}
bool cmp(double a, double b) { return abs(a - b) < 1e-9; }
bool isint(double a) { return cmp(a, round(a)); }
bool isPrime(long long int n) {
  if (n == 2) return 1;
  if (n < 2 || n % 2 == 0) return 0;
  for (long long int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return 0;
  return 1;
}
bool isPalindrome(string str) {
  long long int l = 0;
  long long int h = str.size() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
double EucildDistance(double x, double y, double xx, double yy) {
  return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}
long long int n, m;
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  cin >> n >> m;
  if (n > m) swap(n, m);
  if (n == 1)
    printf("%lld\n", m / 6 * 3 + max(m % 6 - 3, 0ll) << 1);
  else if (n == 2)
    printf("%lld\n", m == 2 ? 0 : m == 3 ? 4 : m == 7 ? 12 : m << 1);
  else
    printf("%lld\n", n * m / 2 * 2);
  return 0;
}
