#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	long long int n,m;
	cin >> n;
	cin >> m;
	n = n/ 1000;
	cout << (n/m)*1000 << endl;

	return 0;
}