#include<iostream>
using namespace std;
int n , a[1005] ;
int main(){
cin >> n ;
for(int i = 1 ; i <= n + 1; i ++) cin >> a[i] ;
for(int i = n ; i >= 0 ; i --){
if(a[i - 1] == 0) continue ;
string s = to_string(a[i + 1]) ;
if((s[0] == '-' && s[1] == '1')|| s[0] == '1') cout << "x^" << i ;
else cout << a[i] << "x^" << i ;
}
}