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