#include<stdio.h>
main(){
    long long N;
    int M;
    scanf("%lld %d",&N,&M);
    N /= 1000;
    printf("%d",N/M*1000);
}