import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int b = sc.nextInt(); int m = sc.nextInt(); StringBuilder sb = new StringBuilder(); while(m > 0){ sb.append(m % b); m /= b; } System.out.println(sb.reverse().toString()); } }