import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int pocky = sc.nextInt(); int longP = sc.nextInt(); sc.close(); if(pocky%(longP*2)==0){ System.out.println(((pocky/(longP*2))-1)*longP); }else{ System.out.println((pocky/(longP*2))*longP); } }// mainmethod } // clas