L, K = map(int, input().split()) i = L // (2 * K) if i == 1: print(0) else: print(i * K)