#include <iostream>
using namespace std;
int main () {
int n;
cin >> n;
int a[10001] = {};
for (int i = 1;i <= n+1;i++) {
cin >> a[i];
}
int tmp = 1;
int cnt = n;
for (int i = 1;i <= n+1;i++) {
if (a[i] == 0) {
cnt--;
continue;
}
else if (a[i] > 0) {
if (tmp != 1) {
cout << "+";
}
}
if (a[i] != 1 && a[i] != -1) cout << a[i];
else if (a[i] == -1) cout << "-";
if (cnt != 0) {
cout << "x^" << cnt;
}
tmp = 2;
cnt--;
}
return 0;
}