print+(<>/1000/<>^0)*1000