plen, spd = map(int, raw_input().split()) if plen <= (spd * 2): print 0 elif plen % (spd * 2) == 0: print (plen / 2) - spd else: print (plen / (spd * 2)) * spd