#include <iostream>

int main() {
	long long int n;
	int m;
	std::cin >> n >> m;
	n /= 1000;
	std::cout << n / m * 1000 << std::endl;
	return 0;
}