int M,N,i; cin>>M>>N; int a[10000]; for(i=0;N!=0;i++) { a[i]=N%10; N/=10; } int count=i-1; for(int j=i-1;j>=0;j--) { if(a[j]==0) { count--; continue; } cout<<a[j]<<"*"<<M<<"^"<<count; count--; if(j>0) { cout<<"+"; } } return 0;}