#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int n;
int main()
{
cin>>n;
int xis[n+2];
for(int i=1;i<=n+1;++i)
cin>>xis[i];
if(xis[1]<0&&xis[1]!=-1)
cout<<"-"<<abs(xis[1])<<"x^"<<n;
else if(xis[1]>0&&xis[1]!=1)
cout<<xis[1]<<"x^"<<n;
else if(xis[1]==1)
cout<<"x^"<<n;
else if(xis[1]==-1)
cout<<"-x^"<<n;
for(int i=n-1,j=2;i>=2;--i,++j)
{
if(xis[j]<0&&xis[j]!=-1)
cout<<"-"<<abs(xis[j])<<"x^"<<i;
else if(xis[j]>0&&xis[j]!=1&&j==2&&xis[j-1]!=0)
cout<<"+"<<xis[j]<<"x^"<<i;
else if(xis[j]>0&&xis[j]!=1&&j==2&&xis[j-1]==0)
cout<<xis[j]<<"x^"<<i;
else if(xis[j]>0&&xis[j]!=1&&j!=2)
cout<<"+"<<xis[j]<<"x^"<<i;
else if(xis[j]==1)
cout<<"+"<<"x^"<<i;
else if(xis[j]==-1)
cout<<"-x^"<<i;
}
if(xis[n]<0&&xis[n]!=-1)
cout<<"-"<<abs(xis[n])<<"x";
else if(xis[n]>0&&xis[n]!=1)
cout<<"+"<<xis[n]<<"x";
else if(xis[n]==1)
cout<<"+"<<"x";
else if(xis[n]==-1)
cout<<"-x";
if(xis[n+1]<0&&xis[n+1]!=-1)
cout<<"-"<<abs(xis[n+1]);
else if(xis[n+1]>0&&xis[n+1]!=1)
cout<<"+"<<xis[n+1];
else if(xis[n+1]==1)
cout<<"+1";
else if(xis[n+1]==-1)
cout<<"-1";
return 0;
}