using static System.Math; using System.Collections.Generic; using System.Linq; using System; public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var m = int.Parse(Console.ReadLine().Trim()); getAns(m, n); } static void getAns(int n, int a) { var t = new List(); while (n >= a) { t.Add(n % a); n /= a; } t.Add(n); t.Reverse(); Console.WriteLine(string.Join("", t)); } }