#include <bits/stdc++.h>   using namespace std;   long long n, m, rr[10][10];   long long func(long long), dp[(1 << 21)];   map<long long, pair<long long, long long> > mr;   long long check(long long i, long long j) {     return (abs(mr[i].first - mr[j].first) + abs(mr[i].second - mr[j].second)) ==            3;   }   int main() {     scanf( %lld %lld , &n, &m);     if (n > m) swap(n, m);     if (n * m <= 21) {       long long x = 0;       for (int i = 0; i < n; i++)         for (int j = 0; j < m; j++) {           mr[x++] = make_pair(i, j);         }       memset(dp, -1, sizeof(dp));       cout << func(0);     } else {       long long ans = 0;       if (n == 1) {         ans += m - m % 6;         m = m % 6;         ans += (m >= 3 ? 2 * (m - 3) : 0);       } else         ans = n * m - (n * m) % 2;       cout << ans <<   n ;     }   }   long long func(long long mask) {     if (dp[mask] != -1) return dp[mask];     long long ans = 0;     for (int i = 0; i < n * m; i++) {       for (int j = i + 1; j < n * m; j++) {         if ((mask & (1 << i)) == 0 && (mask & (1 << j)) == 0 && check(i, j)) {           ans = max(ans, 2 + func(mask | (1 << i) | (1 << j)));         }       }     }     return dp[mask] = ans;   }   