public class Hello { public static void Main() { //var sr = new System.IO.StreamReader("test.txt"); //System.Console.SetIn(sr); string line = System.Console.ReadLine().Trim(); string[] Data = line.Split(' '); int L = int.Parse(Data[0]); int K = int.Parse(Data[1]); double x = (double)(L) /(double)(2 * K); if (x <= 1) { System.Console.WriteLine(0); return; } else if(x == (int)x) { System.Console.WriteLine((int)x * K-K); return; } else { System.Console.WriteLine((int)x * K); return; } } }