import strutils, math const sv = 7 let N = stdin.readLine.parseInt var n = N ans = "" while n != 0: ans.insert (n mod sv).repr n = n div sv echo [ans, "0"][int(ans == "")]