def main(): L, K = map(int, input().split()) n, mod_ = divmod(L, (K * 2)) ans = n * K if mod_ > 0 else (n - 1) * K print(ans) main()