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 (n < 7) { ans.Push(n % 7); n /= 7; } foreach (var a in ans) { Console.WriteLine(a); } } }