#include <bits/stdc++.h>   inline int abs(int n) { return n < 0 ? -n : n; }   bool board[20][20];   int dx[] = {-3, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3};   int dy[] = {0, 1, -1, 2, -2, 3, -3, 2, -2, 1, -1, 0};   int dfs(int p, int n, int m) {     int mx = p, t, cnt = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (!board[i][j]) {           board[i][j] = true;           for (int k = 0; k < 12; k++) {             int ic = i + dx[k], jc = j + dy[k];             if (ic >= 0 && ic < n && jc >= 0 && jc < m && !board[ic][jc]) {               board[ic][jc] = true;               t = dfs(p + 2, n, m);               mx < t && (mx = t);               if (mx == ((m * n) | 1) - 1) return mx;               board[ic][jc] = false;             }           }           board[i][j] = false;           cnt++;           if (m * n - cnt <= mx) return mx;         }       }     }     return mx;   }   int ans[] = {0, 0, 0, 0, 2, 4};   int main() {     int m, n;     scanf( %d%d , &m, &n);     if (m < 10 && n < 10) {       printf( %d n , dfs(0, n, m));     } else if (m == 1) {       printf( %d n , n / 6 * 6 + ans[n % 6]);     } else if (n == 1) {       printf( %d n , m / 6 * 6 + ans[m % 6]);     } else {       printf( %lld n , (((long long)(m)*n) | 1) - 1);     }     return 0;   }   