n = int(input()) m = int(input()) paper_cnt = n//1000 print(1000*(paper_cnt//m))