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(); if(m > 0){ while(m > 0){ sb.append(m % b); m /= b; } }else{ sb.append(0); } System.out.println(sb.reverse().toString()); } }