package yukicoder; import java.util.Scanner; public class N499 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long N=sc.nextLong(); long N7=0; int i=0; do { N7+=(N%7)*(long)Math.pow(10, i); N/=7; i++; }while(N>0); System.out.println(N7); } }