#include <iostream>
using namespace std;
void getTurn(unsigned int M, string& b, int i=0){
unsigned long long cnt = b.length()-i-1;
if (cnt<b.length()) {
getTurn(M, b, i + 1);
if (cnt!=b.length()&&b[cnt]!='0') {
cout << b[cnt] << "*" << M << "^" << i;
if (i<=b.length() && i != 0)
cout << "+";
}
}
}
int main(){
unsigned int M;
string N;
cin>>M>>N;
getTurn(M,N);
return 0;
}