import java.util.*; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int input = in.nextInt(); int n = 7; String ans = Integer.toString(input, n); System.out.println(ans); } }