#include using namespace std; int main(){ long long N, M; cin >> N >> M; if (N % 2 == 0 && M % 2 == 0){ cout << 0 << endl; } else if (!(N % 2 == 1 && M % 2 == 1)){ if (N % 2 == 1){ swap(N, M); } cout << N / 4 << endl; } else { int ans = N / 4 + M / 4; if (N % 4 == 3 && M % 4 == 3){ if (N != 3 && M != 3){ ans--; } } cout << ans << endl; } }