L, K = map(int, input().split()) C = 0 while L >= 0: L -= 2 * K C += K print(C - K)