
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')


# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)



# slower version:

# -*- coding: utf-8 -*-



import sys

def input(): return sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 9)



from collections import deque



N = int(eval(input()))

S = eval(input())



ans = deque()

tmp = ''

l = r = 0

for c in S:

    if c == '(':

        l += 1

        tmp += '('

    else:

        if l == 0:

            ans.appendleft('(')

            ans.append(')')

        else:

            r += 1

            tmp += ')'

            if l == r:

                ans.append(tmp)

                tmp = ''

                l = r = 0

if l > r:

    tmp += ')' * (l-r)

    ans.append(tmp)

print((''.join(ans)))


# optimized version of the same code:

# -*- coding: utf-8 -*-



import sys



def input(): return sys.stdin.readline().strip()

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = 10 ** 18

MOD = 10 ** 9 + 7



N = INT()

S = eval(input())



# それぞれ必要な数を確認

lneed = cnt = 0

for s in S:

    if s == ')':

        cnt += 1

        lneed = max(lneed, cnt)

    else:

        cnt -= 1

rneed = cnt = 0

for s in S[::-1]:

    if s == '(':

        cnt += 1

        rneed = max(rneed, cnt)

    else:

        cnt -= 1



# 辞書順最小なので、(は全部左に、)は全部右に付ける

ans = ('(' * lneed) + S + (')' * rneed)

print(ans)

# -*- coding: utf-8 -*-
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10**9)
from collections import deque

N = int(eval(input()))
S = eval(input())
ans = deque()
tmp = ""
l = r = 0
for c in S:
    if c == "(":
        l += 1
        tmp += "("
    else:
        if l == 0:
            ans.appendleft("(")
            ans.append(")")
        else:
            r += 1
            tmp += ")"
            if l == r:
                ans.append(tmp)
                tmp = ""
                l = r = 0
if l > r:
    tmp += ")" * (l - r)
    ans.append(tmp)
print(("".join(ans)))

# -*- coding: utf-8 -*-
import sys


def input():
    return sys.stdin.readline().strip()


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def list4d(a, b, c, d, e):
    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST(N=None):
    return list(MAP()) if N is None else [INT() for i in range(N)]


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
N = INT()
S = eval(input())
# それぞれ必要な数を確認
lneed = cnt = 0
for s in S:
    if s == ")":
        cnt += 1
        lneed = max(lneed, cnt)
    else:
        cnt -= 1
rneed = cnt = 0
for s in S[::-1]:
    if s == "(":
        cnt += 1
        rneed = max(rneed, cnt)
    else:
        cnt -= 1
# 辞書順最小なので、(は全部左に、)は全部右に付ける
ans = ("(" * lneed) + S + (")" * rneed)
print(ans)

+def list2d(a, b, c): +    return [[c] * b for i in range(a)] + + +def list3d(a, b, c, d): +    return [[[d] * c for j in range(b)] for i in range(a)] + + +def list4d(a, b, c, d, e): +    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] + + +def ceil(x, y=1): +    return int(-(-x // y)) + + +def INT(): +    return int(eval(input())) + + +def MAP(): +    return list(map(int, input().split())) + + +def LIST(N=None): +    return list(MAP()) if N is None else [INT() for i in range(N)] + + +def Yes(): +    print("Yes") + + +def No(): +    print("No") + + +def YES(): +    print("YES") + + +def NO(): +    print("NO") + + -from collections import deque - -N = int(eval(input())) +INF = 10**18 +MOD = 10**9 + 7 +N = INT() -ans = deque() -tmp = "" -l = r = 0 -for c in S: -    if c == "(": -        l += 1 -        tmp += "(" +# それぞれ必要な数を確認 +lneed = cnt = 0 +for s in S: +    if s == ")": +        cnt += 1 +        lneed = max(lneed, cnt) -        if l == 0: -            ans.appendleft("(") -            ans.append(")") -        else: -            r += 1 -            tmp += ")" -            if l == r: -                ans.append(tmp) -                tmp = "" -                l = r = 0 -if l > r: -    tmp += ")" * (l - r) -    ans.append(tmp) -print(("".join(ans))) +        cnt -= 1 +rneed = cnt = 0 +for s in S[::-1]: +    if s == "(": +        cnt += 1 +        rneed = max(rneed, cnt) +    else: +        cnt -= 1 +# 辞書順最小なので、(は全部左に、)は全部右に付ける +ans = ("(" * lneed) + S + (")" * rneed) +print(ans)