CF494A Treasure

Description

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

Input Format

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

Output Format

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

Explanation/Hint

$ |s| $ denotes the length of the string $ s $ .