import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.stream.Stream; public class No00000063_Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[] arr = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); int i = (arr[0] / arr[1]) % 2 == 0 ? 1 : 0; System.out.println(arr[0] <= 2 * arr[1] ? 0 : ((arr[0] / arr[1] / 2 - i) * arr[1])); } }