Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the door consisting of characters '(', ')' and '#'. Below there was a manual on how to open the door. After spending a long time Malek managed to decode the manual and found out that the goal is to replace each '#' with one or more ')' characters so that the final string becomes beautiful. 

Below there was also written that a string is called beautiful if for each i (1 ≤ i ≤ |s|) there are no more ')' characters than '(' characters among the first i characters of s and also the total number of '(' characters is equal to the total number of ')' characters. 

Help Malek open the door by telling him for each '#' character how many ')' characters he must replace it with.


-----Input-----

The first line of the input contains a string s (1 ≤ |s| ≤ 10^5). Each character of this string is one of the characters '(', ')' or '#'. It is guaranteed that s contains at least one '#' character.


-----Output-----

If there is no way of replacing '#' characters which leads to a beautiful string print  - 1. Otherwise for each character '#' print a separate line containing a positive integer, the number of ')' characters this character must be replaced with.

If there are several possible answers, you may output any of them.


-----Examples-----
Input
(((#)((#)

Output
1
2

Input
()((#((#(#()

Output
2
2
1
Input
#

Output
-1

Input
(#)

Output
-1



-----Note-----

|s| denotes the length of the string s.

Difficulty: competition

Starter code:

Solutions:
s = input()
last = s.rfind('#')
dif = s.count('(')-s.count(')')-s.count('#')
try:
    assert dif >= 0
    lev = 0
    out = []
    for i in range(len(s)):
        c = s[i]
        if c == '(': lev += 1
        elif c == ')':
            lev -= 1
            assert lev >= 0
        elif c == '#':
            lev -= 1
            if i == last:
                out.append(dif+1)
                lev -= dif
            else:
                out.append(1)
            assert lev >= 0
    assert lev == 0
    for x in out: print(x)
except AssertionError:
    print(-1)
    


s = input()
ans = []
count = 0
last_pos = s.rfind('#')
for i, c in enumerate(s):
    if c == '(':
        count += 1
    elif c == ')':
        count -= 1
    elif c == '#' and i == last_pos:
        num = max(1, s.count('(') * 2 - len(s) + 1)
        count -= num
        ans.append(num)
    else:
        count -= 1
        ans.append(1)
    if count < 0:
        print(-1)
        break
else:
    for t in ans:
        print(t)
    



s = input()
ans = []
count = 0
last_pos = s.rfind('#')
for i, c in enumerate(s):
    if c == '(':
        count += 1
    elif c == ')':
        count -= 1
    elif c == '#' and i == last_pos:
        num = max(1, s.count('(') * 2 - len(s) + 1)
        count -= num
        ans.append(num)
    else:
        count -= 1
        ans.append(1)
    if count < 0:
        print(-1)
        break
else:
    for t in ans:
        print(t)


s=input()
lis=[0 for i in range(len(s))]
lis1=[]
for i in range(len(s)):
    if s[i]=='(':
        lis[i]=1
    if s[i]==')':
        lis[i]=-1
    if s[i]=="#":
        lis[i]=0
        lis1.append(i)

if sum(lis)<=0:
    print(-1)
else:
    n=sum(lis)
    if n<len(lis1):
        print(-1)
    else:
        for i in range(len(lis1)-1):
            lis[lis1[i]]=-1
        lis[lis1[len(lis1)-1]]=-(n+1-len(lis1))
        lis2=[lis[0]]
        c=1
        if lis[0]<0:
            c=0
        else:
            for i in range(1,len(lis)):
                lis2.append(lis[i]+lis2[i-1])
                if lis2[i]<0:
                    c=0
                    break
        if c==0:
            print(-1)
        else:
            for i in range(len(lis1)-1):
                print(1)
            print(n+1-len(lis1))
                
                
                
    
            


s = input()
ans = []
count = 0
last_pos = s.rfind('#')
for i, c in enumerate(s):
    if c == '(':
        count += 1
    elif c == ')':
        count -= 1
    elif c == '#' and i == last_pos:
        num = max(1, s.count('(') * 2 - len(s) + 1)
        count -= num
        ans.append(num)
    else:
        count -= 1
        ans.append(1)
    if count < 0:
        print(-1)
        break
else:
    for t in ans:
        print(t)
    


a = input()
need = a.count('(') - a.count(')')
hashs = a.count('#')

last = need - (hashs - 1)
if last <= 0:
    print(-1)
    quit()
hashes = [i for i in range(len(a)) if a[i] == '#']

count = 0
for i in range(len(a)):
    if a[i] == '(':
        count += 1
    if a[i] == ')':
        count -= 1
    if a[i] == '#':
        if i == hashes[-1]:
            count -= last
        else:
            count -= 1
    if count < 0:
        print(-1)
        quit()

for i in range(hashs-1):
    print(1)
print(last)

import sys

s = str( input() )

cnt = 0
ans = [0] * len( s )

for i in range( len( s ) ):
    if( s[i] == '(' ):
        cnt += 1
    else:
        cnt -= 1
    if( s[i] == '#' ):
        ans[i] = 1
    if( cnt < 0 ):
        print( -1 )
        return

i = len( s ) - 1

while( s[i] != '#' ):
    i -= 1
    
ans[i] = cnt + 1
cnt = 0

for i in range( len( s ) ):
    if( s[i] == '(' ):
        cnt += 1
    elif( s[i] == ')' ):
        cnt -= 1
    else:
        cnt -= ans[i]
        
    if( cnt < 0 ):
        print( -1 )
        return
    
for i in range( len( s ) ):
    if( s[i] == '#' ):
        print( ans[i] )


#!/usr/bin/env python3

s = input()
count = 0
res = []
last = s.rfind("#")

for i, c in enumerate(s):
    if c == '(':
        count += 1
    elif c == ')':
        count -= 1
    else:
        if i < last:
            res.append(1)
            count -= 1
        else:
            num = max(1, 1 + s.count("(") - s.count("#") - s.count(")"))
            res.append(num)
            count -= num
    if count < 0:
        res = []
        print(-1)
        break
for i in res:
    print(i)


def f(t):
    n = t.count('#') - 1
    k = t.rfind('#') + 1
    t = t.replace('#', ')')
    t = [2 * ord(i) - 81 for i in t]

    a = b = c = 0
    for i in t[k: ]:
        b -= i
        c -= i
        if c < 0: c = 0
    if c > 0: return -1
    for i in t[: k]:
        a -= i
        if a < 0: return -1

    if b + a < 0: return -1
    return '1\n' * n + str(b + a + 1)

print(f(input()))

c = input()  # ���� ������
count_l = 0  # ���������� (
count_r = 0  # ���������� )
h = c.count('#')
ans = [1]*h
n = len(c)

flag = 1
a = [0]*(n+1)

for i in range(n):
    if c[i] == '(':
        a[i+1] = a[i]+1
    else:
        a[i+1] = a[i]-1
    if a[i+1] < 0:
        flag = 0
        break

if flag == 0:
    print(-1)
else:
    ans[h-1] += a[n]
    pos = 0
    flag = 1
    
    for i in range(n):
        if c[i] == '(':
            count_l += 1
        elif c[i] == ')':
            count_r += 1
        else:
            count_r += ans[pos]
            pos += 1
        if count_r > count_l:
            flag = 0
            break
    
    if flag:
        for i in range(h):
            print(ans[i])
    else:
        print(-1)

s = input()
n = len(s)
ptr = n - 1
balance = 0
while s[ptr] != '#':
	if s[ptr] == ')':
		balance += 1
	else:
		balance -= 1
	ptr -= 1
	if balance < 0:
		print(-1)
		return
sharps = s.count('#')
balance = 0
for i in range(ptr):
	if s[i] == '(':
		balance += 1
	else:
		balance -= 1
	if balance < 0:
		print(-1)
		return
ans = s.count('(') - s.count(')') - (sharps - 1)
if ans <= 0:
	print(-1)
	return
for i in range(sharps - 1):
	print(1)
print(s.count('(') - s.count(')') - (sharps - 1))


import sys
st = input()
a = 0
b = 0
last = 0
v = []
for s in st:
	if s == "(":
		a += 1
	elif s == ")":
		a -= 1
	elif s == "#":
		a -= 1
		v.append(1)
	if a < 0:
		print(-1)
		return

v[-1] += a
i=0
a = 0
for s in st:
	if s == "(":
		a += 1
	elif s == ")":
		a -= 1
	elif s == "#":
		a -= v[i]
		i += 1
	if a < 0:
		print(-1)
		return
if a != 0:
	print(-1)
else:
	for vs in v:
		print(vs)




'''

@author: linhz
'''

import sys

def __starting_point():
    s = input()
    leftCount = 0
    ansList = []
    ansFlag = True
    sharpCount = 0
    for c in s:
        if c == '(':
            leftCount += 1
        elif c == ')':
            leftCount -= 1
            if leftCount < 0:
                ansFlag = False
        elif c == '#':
            leftCount -= 1
            if leftCount < 0:
                ansFlag = False
            else:
                ansList.append(1)
                sharpCount += 1
        else:
            sys.stderr.write("Unexpected character:%c" % (c))
    if ansFlag:
        ansList[-1] += leftCount
        leftCount = 0
        sharpCount = 0
        for c in s:
            if c == '(':
                leftCount += 1
            elif c == ')':
                leftCount -= 1
                if leftCount < 0:
                    ansFlag = False
            elif c == '#':
                leftCount -= ansList[sharpCount]
                sharpCount+=1
                if leftCount < 0:
                    ansFlag = False
            else:
                sys.stderr.write("Unexpected character:%c" % (c))
        if ansFlag:
            for i in ansList:
                print(i)
        else:
            print(-1)
    else:
        print(-1)

__starting_point()

s=input()
a,b,c='(',')','#'
s1=len(s)
a1,b1,c1,r=0,0,0,1
if(s[-1]==a):
    print(-1)
else:
    for i in range(s1):
        if(s[i]==a):
            a1+=1
        if(s[i]==b):
            b1+=1
        if(s[i]==c):
            c1+=1
        if(b1+c1>a1):
            r=0
            break
    if(r==0):
        print(-1)
    else:
        m=0
        for i in range(s1):
            if(s[i]==c):
                break
            if(s[i]==a):
                m+=1
            if(s[i]==b):
                m-=1
        k=a1-b1
        for i in range(c1-1):
            print(1)
        if(k>=c1):
            if(c1==1):
                if(k-c1+1>m):
                    print(-1)
                else:
                    print(k-c1+1)
            else:
                print(k-c1+1)






s=input(); a=0; b=[]
for x in s:
    if x == "(":
        a+=1
    else:
        if x==")":
            a-=1
        else:
            a -= 1
            b.append(1)
        if a < 0:
            print(-1)
            return
b[-1]+=a;

a=0; i=0
for x in s:
    if x=="(":
        a += 1
    else:
        if x==")":
            a-=1
        else:
            a-=b[i]; i+=1
        if a<0:
            print(-1)
            return
if a != 0:
    print(-1)
else:
    for x in b:
        print(x)
    


    


#!/usr/bin/env python3
import collections, itertools, functools, math

def valid(s, r):
    r = iter(r)
    op = 0
    cl = 0
    for c in s:
        if c == '(':
            op += 1
        elif c == ')':
            cl += 1
        elif c == '#':
            cl += next(r)
        if cl > op:
            return False
    return True

def solve(s):
    FAIL = [-1]
    op = s.count('(')
    cl = s.count(')')
    h = s.count('#')

    if cl + h > op:
        return FAIL

    r = [1]*h
    r[-1] += (op-cl-h)

    if not valid(s, r):
        return FAIL
    return r

def __starting_point():
    for n in solve(input()):
        print(n)


__starting_point()

# 494A
# θ(|s|) time
# θ(|s|) space

__author__ = 'artyom'


# SOLUTION

def main():
    s = read(0)
    n = len(s)
    ex = 2 * s.count('(') - n
    if ex < 0:
        return -1
    res = []
    l = i = 0
    last = s.rfind('#')
    for i in range(n):
        c = s[i]
        if c == '(':
            l += 1
        elif c == ')':
            l -= 1
        else:
            if l == 0:
                return -1
            k = 1 if i < last else 1 + ex
            res.append(k)
            l -= k
        if l < 0:
            return -1
    return res


# HELPERS

def read(mode=1, size=None):
    # 0: String
    # 1: Integer
    # 2: List of strings
    # 3: List of integers
    # 4: Matrix of integers
    if mode == 0: return input().strip()
    if mode == 1: return int(input().strip())
    if mode == 2: return input().strip().split()
    if mode == 3: return list(map(int, input().strip().split()))
    a = []
    for _ in range(size):
        a.append(read(3))
    return a


def write(s="\n"):
    if s is None: s = ''
    if isinstance(s, tuple) or isinstance(s, list): s = '\n'.join(map(str, s))
    s = str(s)
    print(s, end="\n")


write(main())

s = input().replace("()", "")
t = s.count("(") - s.count(")") - s.count("#")
if t < 0 or s.index("#") < s.index("("): 
  print(-1)
  quit()
l = [1]*s.count("#")
l[-1] += t
i = [k for k, l in enumerate(s) if l == "#"]
a, b = 0, 0
for x in range(len(s)):
  if s[x] == "(":
    a += 1
  elif s[x] == ")":
    b += 1
  elif s[x] == "#" and x != i[-1]:
    b += 1
  elif s[x] == "#":
    b += t + 1
  if a < b:
    print(-1)
    quit()
  # print(a, b, s)
if a != b:
  print(-1)
else:
  print("\n".join(map(str, l)))
      
        


import sys
st = input()
a = 0
b = 0
last = 0
v = []
for s in st:
	if s == "(":
		a += 1
	elif s == ")":
		a -= 1
	elif s == "#":
		a -= 1
		v.append(1)
	if a < 0:
		print(-1)
		return

v[-1] += a
i=0
a = 0
for s in st:
	if s == "(":
		a += 1
	elif s == ")":
		a -= 1
	elif s == "#":
		a -= v[i]
		i += 1
	if a < 0:
		print(-1)
		return
if a != 0:
	print(-1)
else:
	for vs in v:
		print(vs)






# Made By Mostafa_Khaled


s=input()
w=s.rindex("#")
q=0

for i in range(len(s)-1,w,-1) :
    if s[i]=="(" :
        q+=1
    else :
        q-=1
    if q>0 :
        print(-1)
        return
d=0
zz=[]
for i in range(w) :
    if s[i]=="(" :
        d+=1
    elif s[i]==")" :
        d-=1
    else :
        d-=1
        zz.append(1)
    if d<0 :
        print(-1)
        return
y=q+d
if y<=0 :
    print(-1)
else :
    zz.append(y)
    print("\n".join(map(str,zz)))
        
    


def __starting_point():
    s = input()
    ans = []
    cnt, key, tmp, new = 0, True, 0, 0
    for e in s:
        if e == '(':
            cnt += 1
            new += 1
        elif e == ')':
            cnt -= 1
            if new > 0:
                new -= 1
            if cnt < 0:
                key = False
                break
        else:
            if cnt == 0:
                key = False
                break
            new = 0
            ans.append(1)
            cnt -= 1
            tmp = cnt
    if not key or tmp < cnt or new > 0:
        print(-1)
    else:
        ans[-1] += cnt
        for e in ans:
            print(e)


__starting_point()

def needs_trailing(segment):
    open_parens = 0
    for i in segment:
        if i == '(':
            open_parens += 1
        elif i == ')' or i == '#':
            open_parens -= 1

        if open_parens < 0:
            return -1
    return open_parens


line = input()
extra_parens = needs_trailing(line)
last_segment_needs = needs_trailing(line.split('#')[-1])

if extra_parens < 0:  # too many ) already in string
    print(-1)
elif last_segment_needs > 0:  # end block isn't beautiful, can't fix
    print(-1)
else:
    outputs = [1 for i in range(line.count('#'))]
    outputs[-1] += needs_trailing(line)  # if valid, add all extras to the last space
    new_str = line.rpartition('#')[0].replace('#', ')') + outputs[-1] * ')' + line.rpartition('#')[-1]
    if needs_trailing(new_str) != 0:
        print(-1)
    else:
        for output in outputs:
            print(output)



s = input()
ret = [None] * len(s)
bal = [None] * len(s)
b = 0
last = None
for i, c in enumerate(s):
    if c == '(':
        b += 1
    elif c == ')':
        b -= 1
    else:
        ret[i] = 1
        b -= 1
        last = i
    if b < 0:
        print(-1)
        return
    bal[i] = b
rem = bal[-1]
ret[last] += rem
for i in range(last, len(bal)):
    bal[i] -= rem
print('\n'.join(map(str, filter(lambda x: x, ret))) if min(bal) >= 0 else -1)