//#define _USE_MATH_DEFINES //M_PI #include //std::cout, std::cin //#include //std::string //#include //std::vector //#include //std::valarray 数値のみの一次配列 //#include //std::sort //#include //localtime_s //#include //abs //#include //abs, std::pow, sqrt, sin, cos, //#include //std::ifstream //#include //std::setprecision //#include //std::random(C++11) //#include //std::accumulate int main(void) { //test用 //std::ifstream in("test.txt"); //std::cin.rdbuf(in.rdbuf()); int L, K; std::cin >> L >> K; if (L % (2 * K) != 0) { std::cout << (L / (2 * K))*K << std::endl; } else { std::cout << (L / (2 * K) - 1)*K << std::endl; } }