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