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