#include using namespace std; int main() { ios::sync_with_stdio(false); //读入输出优化的强迫症 int n, x, qaq = 0; cin >> n; char a; queue q, qq; while (cin >> a) { if (a == 0) break; q.push(a); qaq += (a - '0'); } x = q.size(); while (!q.empty()) { x--; if (q.front() != '0') { qaq--; cout << q.front() << '*' << n << '^' << x; if (x != 0 && qaq != 0) cout << '+'; } q.pop(); } return 0; }