def main(): L, K = map(int,input().split()) ans = 0 while True: L = L - (K * 2) if L == 0: break ans += K if L <= (K * 2): break print(ans) if __name__ == "__main__": main()