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