#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
int main(){
  LL n,m;
  cin >> n >> m;
  cout << n/1000/m*1000 << endl;
  
  return 0;
}