import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); String ans = ""; while (true) { if (n/7 == 0) { ans += n%7; break; } else { ans += n%7; n /= 7; } } StringBuilder sb = new StringBuilder(ans); System.out.println(sb.reverse()); } }