#include <bits/stdc++.h>
using namespace std;
 
#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin >> s;

  int st;
  int N = s.size();
  for ( int i = 0; i < N; i++ ) {
    if ( s[i] == '*' ) st = i;
  }

  int ans = 0;
  for ( int i = 0; i < N; i++ ) {
    for ( int j = i+1; j < N; j++ ) {
      if ( s[i] != '(' || s[j] != ')' ) continue;
      if ( st < i || j < st ) continue;
      int cnt = 0;
      bool flag = true;
      for ( int k = i+1; k <= j-1; k++ ) {
	if ( s[k] == '*' ) continue;
	if ( s[k] == '(' ) cnt++;
	else cnt--;
	if ( cnt < 0 ) flag = false;
      }
      if ( cnt != 0 ) continue;
      if ( flag ) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

