#include <bits/stdc++.h>
using namespace std;
//直接模拟所有情况
int main() {
int n;
cin >> n;
int a[105];
string s;
for (int i = 0; i < n + 1; i++) {
cin >> a[i];
}
//用于判断是否为第一个有效系数
bool first = false;
//总体思路为先处理所有的符号,再连接数
for (int i = 0; i < n + 1; i++) {
//如果系数为0,直接跳出本次循环,进行下一个系数的遍历
if (a[i] == 0) {
continue;
}
//第一种特殊情况:对首项的处理,正数不加“+”,负数加“-”
if (!first) {
if (a[i] < 0) {
s = s + '-';
}
first = true;
} else { //非首项的符号处理
if (a[i] > 0) {
s += '+';
} else {
s += '-';
}
}
//对数值处理(包括系数和次数)
int abs_a=abs(a[i]);
int degree=n-i;
//先0后1
//第二种特殊情况:次数为0(系数不会为0了)
if(degree==0){
s+=to_string(abs_a);
}
else{
//次数不为0的所有情况
//系数为1(次数:1/非1);系数非1(次数:1/非1)
if(abs_a==1){
if(degree==1){
s+="x";
}
else{
s=s+"x^"+to_string(degree);
}
}
else{
if(degree==1){
s=s+to_string(abs_a)+"x";
}
else{
s=s+to_string(abs_a)+"x^"+to_string(degree);
}
}
}
}
cout<<s<<endl;
}
// 64 位输出请用 printf("%lld")