using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoder_51 { class Program { static void Main(string[] args) { int w = int.Parse(Console.ReadLine()); int d = int.Parse(Console.ReadLine()); double l; for (; d > 1; d--) { l = w / (d * d); l = Math.Floor(l); w -= (int)l; } Console.WriteLine(w); Console.ReadLine(); } } }