using System; using System.Globalization; class Program { public static void Main(string[] args) { var w = int.Parse(Console.ReadLine()); var d = int.Parse(Console.ReadLine()); for (int i = d; i > 0; i--) { if (i == 1) { Console.WriteLine(w.ToString(CultureInfo.InvariantCulture)); return; } var work = (int) ((double) w/i/i); w -= work; } } }