import java.util.Scanner; public class henkan7 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner (System.in); Long N = Long.parseLong(sc.next()); System.out.println(Long.toString(N,7)); } }