import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main (String[] args) { // 入力値の読み込み Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long m = sc.nextLong(); long nx = n/1000; long ans =nx/m*1000; System.out.println(ans); } }