#include int main(){ long int l; int k; scanf("%ld %d", &l, &k); int eat = l / (2*k); if( l % (2*k) == 0){ eat--; } printf("%d\n", eat*k); return 0; }