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