using System; namespace SevenDecimal { class Program { static void Main(string[] args) { ulong radix = 7; ulong value = ulong.Parse( Console.ReadLine() ); ulong result = 0; ulong quot; for( int i = 10; i >= 0; i--) { quot = (ulong)Math.Floor(value / Math.Pow(radix, i)); if ( quot > 0) { result = result + ( quot * (ulong)Math.Pow(10,i) ); value -= ( quot * (ulong)Math.Pow(radix, i) ); } } Console.WriteLine(result); } } }