import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); ArrayList L = new ArrayList<>(); while(true){ L.add(N%7); N/=7; if(N==0)break; } for(int i=L.size()-1; i>=0; i--){ System.out.print(L.get(i)); }System.out.println(); } }