#include using namespace std; int a, b; int main() { cin >> a >> b; cout << (a - 1) / (b * 2) * b << endl; return 0; }