n = int(input())
a = list(map(int, input().split()))

is_first_term = True#是否多项式首项
result = []
for i in range(n + 1):
    coeff = a[i]#系数
    degree = n - i#指数

    if coeff == 0:#若该项系数为0,直接跳过
        continue

    term_str = ""#处理多项式符号
    if is_first_term:#是多项式首项,则无符号或只有负号
        if coeff < 0:
            term_str += "-"
    else:#不是多项式首项,正负号正常处理
        if coeff > 0:
            term_str += "+"
        else:
            term_str += "-"
    is_first_term = False#把多项式首项标记符置为否,多项式首项符号已处理

    abs_coeff = abs(coeff)#处理系数绝对值
    if abs_coeff != 1 or degree == 0:#如果系数项绝对值不等于1或当前项为最后的常数项
        term_str += str(abs_coeff)
    if degree > 0:#处理变量和指数
        term_str += "x"
        if degree > 1:
            term_str += f"^{degree}"
            
    result.append(term_str)

if not result: # 如果所有系数都是0,continue跳过没被处理
    print("0")
else:
    print("".join(result))