#include <bits/stdc++.h>
using namespace std;
int main() {
    unsigned long long N, M, konacan;
    cin >>N>>M;
    konacan=N*M;
    unsigned long long dvaN=N/2;
    unsigned long long dvaM=M/2;
    konacan=konacan-dvaN*dvaM;
    unsigned long long triN=N/3;
    unsigned long long triM=M/3;
    konacan=konacan-triN*triM;

    cout <<konacan<<endl;
return 0;
}