package yukicoder; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int dec = sc.nextInt(); String sep = ""; int num = 7; int power = num; while(true){ while(true){ int work = dec / power; if(work <= 0){ power /= num; break; } power *= num; } for(int i = 1 ; i <= num ; i++){ int work = dec / (power*i); System.out.println(dec+" "+ work); if(work <= 0){ sep += Integer.toString(i-1); if(i != 1){ dec %= (power*(i-1)); } break; } } if(dec < num){ sep += Integer.toString(dec); break; } } System.out.println(sep); } }