a, b = map(int, input().split()) k = a // (2 *b) l = a % (2*b) if l == 0: print(b * (k-1)) else: print(b * k)