#include int main(void){ int L, K, count; scanf("%d %d", &L, &K); count = (L + 2 * K - 1) / (2 * K) - 1; printf("%d", count * K); return 0; }