#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, m; cin >> n >> m; if(n % 2 == 0){ cout << n * m << '\n'; return 0; } ll g = 1ll << __lg(m) + 1; g--; cout << (n - 1) * (g + m) / 2 << '\n'; }