#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
	long N, M;
	cin >> N >> M;
	cout << N / 1000 / M * 1000 << endl;
}