import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args){ Scanner s = new Scanner(System.in); String str = s.next(); s.close(); long l = Long.parseLong(str); long ltmp = l; Stack stack = new Stack(); while(true){ stack.push(ltmp%7); if(ltmp/7 < 7){ stack.push(ltmp/7); break; } ltmp = ltmp/7; } while(!stack.empty()){ System.out.print(stack.pop()); } System.out.println(""); } }