#include int main(void){ int l, k; int times = 0; scanf( "%d %d", &l, &k ); times = l % ( k * 2 ) == 0 ? ( l / ( k * 2 ) ) - 1 : ( l / ( k * 2 ) ); printf( "%d", k * times ); }