#include <iostream>
using namespace std;
int n;
int main(){
cin >> n;
int t;
bool first = true;
for (int i = n; i >= 0; i -- ){
cin >> t;
if(!t)continue;
if(!first && t>0)cout << "+";
else if(t<0)cout << '-';
if(abs(t) != 1 || !i)cout << abs(t);
if(i) cout << "x";
if(i>1)cout <<'^' << i;
first = false;
}
}