#include <stdio.h>

char buf[65] = {0};
int base;

char *main (int x, int y, char* s){
	return y && scanf("%d %d", &base, &x, printf("Enter base and number: ")) && main(x, 0, buf) && puts(buf)
	? 0 : x && (s = main(x / base, 0, s)) && (y[s] +=  10 > (y[s] = x % base) ? '0' : -10 - (-'A'))
	? &1[s] : (x[s] = '0', &x[s + 1]);
}