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