#include <bits/stdc++.h>
using namespace std;
long long n, m, r[100][100], ans, p, q, u[6] = {-2, -1, 0, 1, 2, 3},
                                        v[6] = {1, 2, 3, 2, 1, 0};
long long arr[6] = {0, 1, 2, 3, 2, 1};
void f(int x, int y, int c) {
  if (x >= p) {
    ans = max(ans, (long long)c);
    return;
  }
  if (y >= q) {
    f(x + 1, 0, c);
    return;
  }
  f(x, y + 1, c);
  if (r[x][y] == 0) {
    r[x][y] = 1;
    for (int i = 0; i < 6; i++) {
      int tx = x + u[i], ty = y + v[i];
      if (0 <= tx && tx < p && 0 <= ty && ty < q)
        if (r[tx][ty] == 0) {
          r[tx][ty] = 1;
          f(x, y + 1, c + 1);
          r[tx][ty] = 0;
        }
    }
    r[x][y] = 0;
  }
}
int main() {
  scanf("%lld%lld", &n, &m);
  if (n > m) swap(n, m);
  if (n == 1) {
    printf("%lld\n", m - arr[m % 6]);
  } else if (n == 2 && m == 2) {
    printf("0\n");
  } else if (n == 2 && (m == 3 || m == 7)) {
    printf("%lld\n", n * m - 2);
  } else if (n % 2 && m % 2) {
    printf("%lld\n", n * m - 1);
  } else
    printf("%lld\n", n * m);
}
