import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack;  public class Main { public static int count = 0;   public static void main(String args[]) throws IOException {
        String str;  BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));  while((str = bufferedReader.readLine() )!=null){ int tag[] = new int[str.length()];  for(int i=0; i<str.length(); ++i){ if(str.charAt(i) == '(')
                     tag[i] = 1;  else  tag[i] = 2;  } count = 0;  getCount(str, tag, 1);  System.out.println(count);  }
        bufferedReader.close();  } public static void getCount(String s, int tag[], int m){ int tagCount = 0;  for (int i=0; i<tag.length; i++){ if(tag[i] == 0)
                tagCount++;  } if(tagCount == tag.length) { count++;  return;  } if(m == 1){ for (int i=0; i<s.length(); i++){ if(tag[i] == 0) continue;  if (s.charAt(i) == '('){
                    tag[i] = 0;  getCount(s, tag, 2);  tag[i] = 1;  break;  }
            }
        } else if(m == 2){ for (int i=0; i<s.length(); i++){ if(tag[i] == 0) continue;  if(s.charAt(i) == ')'){
                    tag[i] = 0;  if(isRight(s, tag)){ getCount(s,tag, 1);  }
                    tag[i] = 2;  }
            }
        }
    } public static boolean isRight(String s, int tag[]){
        Stack<Character> stack = new Stack<>();  for (int i=0; i<s.length(); ++i){ if(tag[i] == 0) continue;  if(s.charAt(i) == '('){
                stack.push(s.charAt(i));  } else if(s.charAt(i) == ')'){ if(stack.empty()) return false;  if(stack.pop() != '(') return false;  }
        } if (stack.empty()) return true;  else  return false;  }
}