using System.Collections.Generic;
using System;
using System.Linq;
using System.Drawing;

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            var M = int.Parse(Console.ReadLine());

            if(N / M >= 1000)
            {
                long a = N / 1000;
                long b = a / M;
                long money = b * 1000;
                Console.WriteLine(money);
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }
}