import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.stream.Stream; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // L K int[] lk = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); int numL = lk[0]; int numK = lk[1]; int count = 0; while (numL > numK * 2 * count) { count++; } System.out.println(numK * (count - 1)); } }