def main(): N = int(input()) M = int(input()) print(((N // 1000) // M) * 1000) if __name__ == "__main__": main()