#include    <stdio.h>

int main(void)
{
    unsigned long   N, M;

    scanf("%ld", &N);
    scanf("%ld", &M);

    printf("%ld\n", (N / M / 1000) * 1000);

    return 0;
}