import java.util.Scanner;
public class convierteInt {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
System.out.println("\nIndica en la base(max 36): ");
int d = sc.nextInt();
d=d>36?36:d;
System.out.println("\nIndica el numero a convertir a (base "+d+"): ");
int n = sc.nextInt();
System.out.print(" (base "+d+"): "+toBASE(n,d)+"\n");
}
public static String toBASE(int n,int d){
String b = "";
String c = "";
while (n != 0){
int r = (int)(n % d); // remainder
if(r>9){
if(r==10)
c = "A";
else if(r==11)
c = "B";
else if(r==12)
c = "C";
else if(r==13)
c = "D";
else if(r==14)
c = "E";
else if(r==15)
c = "F";
else if(r==16)
c = "G";
else if(r==17)
c = "H";
else if(r==18)
c = "I";
else if(r==19)
c = "J";
else if(r==20)
c = "K";
else if(r==21)
c = "L";
else if(r==22)
c = "M";
else if(r==23)
c = "N";
else if(r==24)
c = "O";
else if(r==25)
c = "P";
else if(r==26)
c = "Q";
else if(r==27)
c = "R";
else if(r==28)
c = "S";
else if(r==29)
c = "T";
else if(r==30)
c = "U";
else if(r==31)
c = "V";
else if(r==32)
c = "W";
else if(r==33)
c = "X";
else if(r==34)
c = "Y";
else if(r==35)
c = "Z";
b = c + b;
}else
b = r + b; // concatenate remainder
n /= d; // reduce n
}
return b;
}
}