#include int main() { int length, e; std::cin >> length >> e; int l = length / (e * 2); if (length % (e * 2) == 0)l--; std::cout << l * e << std::endl; return 0; }