#include <iostream>
using namespace std;
int main() {
int n, x;
cin >> n;
n++;
cin >> x;
if (n == 1) {
cout << x << endl;
return 0;
}
if (x != 1)
cout << x;
cout << "x^" << n - 1;
for (int i = n - 2; i >= 1; i--) {
cin >> x;
if (x == 0)
continue;
if (x >= 0) {
cout << "+";
} else {
cout << "-";
}
if (abs(x ) != 1)
cout << abs(x);
cout << "x^" << i;
}
cin >> x;
if (x != 0) {
if (x >= 0)
cout << '+';
cout << x;
}
cout << endl;
}