main = getLine >>= print . pocky . map read . words pocky [l,k] = let (d,m) = divMod l (2*k) in k * (d - (if m==0 then 1 else 0))