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