def main(): N = int(input()) M = int(input()) ans = N // 1000 // M * 1000 print(ans) main()