import Data.List main = do li <- getLine let [l,k] = map read $ words li print $ compute k 0 l compute k a l | l <= k*2 = a | True = compute k (a+k) (l-k-k)