#include <bits/stdc++.h>
using namespace std;
int tr[5][5] = {{0, 0, 0, 2, 4},
                {0, 0, 4, 8, 10},
                {0, 4, 8, 12, 14},
                {2, 8, 12, 16, 18},
                {4, 10, 14, 18, 24}};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (n < m) swap(n, m);
  long long ans = 0;
  if (m == 1)
    ans += n / 6 * 6, n %= 6, ans += tr[0][n - 1];
  else if (n % 4 == 0 || m % 4 == 0)
    ans = (long long)n * m;
  else if (n % 6 == 0 || m % 6 == 0)
    ans = (long long)n * m;
  else if (n <= 5 && m <= 5)
    ans = tr[n - 1][m - 1];
  else if (n == 7 && m == 2)
    ans = 12;
  else
    ans = (long long)n * m / 2 * 2;
  printf("%lld\n", ans);
  return 0;
}
