#include <iostream>
#include <string>
#include <stack>
using namespace std;
bool BrMa(const string& s){
bool res=true;
stack<char> BrStack;
for(int i=0;i<s.length();++i){
if(s[i]=='('){
BrStack.push(s[i]);
}//if
else if(s[i]==')'){
if(!BrStack.empty())
BrStack.pop();
else{
res=false;
break;
}
}//else if
}//for
//*************bug***********
if(!BrStack.empty()&&res==true)
res=false;
return res;
}
int main(){
string s1="((()())";
string s2="(()))";
string s3="((6-8)(0))";
string s4="";
cout<<BrMa(s1)<<BrMa(s2)<<BrMa(s3)<<BrMa(s4);
}