#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; ll M; cin >> N; cin >> M; N/=1000; cout <<N/M * 1000 << endl; }