大史

import sys
import math
import queue
import itertools
import heapq
from collections import deque
from array import array
from bisect import bisect_right


def read():
    line = sys.stdin.readline()
    if not line:
        return []
    return list(map(int, line.split()))


def readf():
    line = sys.stdin.readline()
    if not line:
        return []
    return list(map(float, line.split()))


mod = 10**9 + 7
inf = 10**18


def solve():
    n = read()[0]
    a = read()
    now = n + 1
    for x in a:
        now -= 1
        if now == 0:
            if x > 0:
                print("+", x, sep='')
            elif x < 0:
                print(x)
            continue
        if now == 1:
            if x==0:
                continue
            if x == 1:
                print("+x", end='')
            elif x == -1:
                print("-x", end='')
            elif x > 0:
                print("+{}x".format(x), end='')
            else:
                print("{}x".format(x), end='')
            continue

        if x != 0:
            if now == n:
                if x == 1:
                    print("x^{}".format(now), end='')
                elif x == -1:
                    print("-x^{}".format(now), end='')
                else:
                    print("{}x^{}".format(x, now), end='')
            else:
                if x == 1:
                    print("+x^{}".format(now), end='')
                elif x == -1:
                    print("-x^{}".format(now), end='')
                elif x > 0:
                    print("+{}x^{}".format(x, now), end='')
                else:
                    print("{}x^{}".format(x, now), end='')


def main():
    t = 1
    # t = int(sys.stdin.readline())
    for _ in range(t):
        solve()


if __name__ == "__main__":
    main()