using System; using System.Linq; using System.Collections.Generic; class No499 { static void Main() { var ans = new Stack(); var n = Int32.Parse(Console.ReadLine()); while (true) { ans.Push(n % 7); if(n<7)break; n /= 7; } foreach (var a in ans) { Console.WriteLine(a); } } }