using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { new Magatro().Solve(); } } public class Magatro { public void Solve() { int n = int.Parse(Console.ReadLine()); if (n == 0) { Console.WriteLine(0); return; } string ans = ""; while (n > 0) { ans = n % 7 + ans; n /= 7; } Console.WriteLine(ans); } }