import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(),a[]=new int[11],t=0,i; sc.close(); do { a[t]=n%7; t++; n/=7; }while(n>0) ; for(i=t;i>0;i--) System.out.print(a[i-1]); } }