import java.util.*; public class Main { public static void main(String[] args ) throws Exception { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int x = sc.nextInt(); if(N/x/2==1 && N%x==0){ System.out.println(0); }else{ int y=(N/x/2)*x; System.out.println(y); } } }