#include <bits/stdc++.h>
using namespace std;
int dp[100][100];
int main() {
string s;
cin >> s;
dp[0][0] = 1;
for (int i = 1; i <= int(s.size()); i++) {
for (int j = 0; j <= 80; j++) {
if (s[i - 1] == '(') {
if (j > 0) {
dp[i][j] = dp[i - 1][j - 1];
}
}
if (s[i - 1] == ')') {
dp[i][j] = dp[i - 1][j + 1];
}
if (s[i - 1] == '?') {
dp[i][j] = dp[i - 1][j + 1];
if (j > 0) {
dp[i][j] += dp[i - 1][j - 1];
}
}
}
}
cout << dp[s.size()][0];
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgZHBbMTAwXVsxMDBdOwogCmludCBtYWluKCkgewogICAgc3RyaW5nIHM7CiAgICBjaW4gPj4gczsKICAgIGRwWzBdWzBdID0gMTsKIAogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gaW50KHMuc2l6ZSgpKTsgaSsrKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPD0gODA7IGorKykgewogICAgICAgICAgICBpZiAoc1tpIC0gMV0gPT0gJygnKSB7CiAgICAgICAgICAgICAgICBpZiAoaiA+IDApIHsKICAgICAgICAgICAgICAgICAgICBkcFtpXVtqXSA9IGRwW2kgLSAxXVtqIC0gMV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHNbaSAtIDFdID09ICcpJykgewogICAgICAgICAgICAgICAgZHBbaV1bal0gPSBkcFtpIC0gMV1baiArIDFdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzW2kgLSAxXSA9PSAnPycpIHsKICAgICAgICAgICAgICAgIGRwW2ldW2pdID0gZHBbaSAtIDFdW2ogKyAxXTsKICAgICAgICAgICAgICAgIGlmIChqID4gMCkgewogICAgICAgICAgICAgICAgICAgIGRwW2ldW2pdICs9IGRwW2kgLSAxXVtqIC0gMV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAKICAgIGNvdXQgPDwgZHBbcy5zaXplKCldWzBdOwogCiAgICByZXR1cm4gMDsKfQ==