# a=input()
# stack=[]
# b=0
# for i in range(len(a)):
# if a[i]=='(' or a[i]=='[':
# stack.append(a[i])
# elif a[i]==')' or a[i]==']':
# tot=0
# while True:
# if len(stack)==0 :
# print(0)
# exit()
# b=stack.pop()
# if b=='(' or b=='[':
# if a[i]==')' and b=='[' or a[i]==']' and b=='(':
# print(0)
# exit() # 프로그램 종료
# break
# else:
# tot=tot+b
# if tot==0:
# tot=1
# if a[i]==')':
# tot=tot*2
# else:
# tot=tot*3
# stack.append(tot)
# if stack.count('(')+stack.count('[') > 0 :
# print(0)
# else :
# print(sum(stack))