class Human{ int eatLength; int eatedPokkey; public Human(int i){ this.eatLength = i; this.eatedPokkey = 0; } } public class No_63{ public static void main(String[] args){ java.util.Scanner sc = new java.util.Scanner(System.in); int pokkey = sc.nextInt(); int k = sc.nextInt(); Human haruka = new Human(k); Human yuu = new Human(k); while(pokkey > 0){ if(pokkey - (haruka.eatLength + yuu.eatLength) > 0){ haruka.eatedPokkey += haruka.eatLength; yuu.eatedPokkey += yuu.eatLength; pokkey -= haruka.eatLength + yuu.eatLength; } else{ haruka.eatedPokkey += pokkey; pokkey = 0; } } System.out.println(yuu.eatedPokkey); sc.close(); } }