import java.util.Scanner;
public class MyTestJava {
static Scanner sc = new Scanner(System.in);
static int number = 1, redis = 1;
public static void main(String[] args) {
while(number!=0&&redis!=0){
inputNum();
}
sc.close();
}
static void inputNum(){
System.out.print("InPutNumber:");
number = Integer.valueOf(sc.nextLine().trim());
System.out.print("InputBase:");
redis = Integer.valueOf(sc.nextLine().trim());
toArys(number, redis);
System.out.println("--------------------");
}
static void toArys(int number, int ary) {
int arr[] = new int[100], len = 0, num = number;
while (number != 0) {
arr[len++] = number % ary;
number /= ary;
}
String str = "";
for (int i = len-1; i >= 0; i--) {
str += arr[i];
}
System.out.println("[" + num + "]-->[" + ary + "]:" + str);
}
}