#include <iostream>
using namespace std;

int main() 
{
    // write a program to convert from decimal to any base
    
    int num,base;
    cin >> num >> base;
    
    string s="";
    while(num>0){
      s = to_string(num%base) + s;
      num/=base;
    }
    
    cout << s << endl;
        
    return 0;
} 
by