#include int main() { int L, K; scanf( "%d%d", &L, &K ); printf( "%d\n", (L/(2*K)-!(L%(2*K)))*K ); return 0; }