import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author cteam92
*/
public class Fq {
/**
* @param args the command line arguments
*/
public static void main
(String[] args
) { Scanner sc
= new Scanner
(System.
in); while (true) {
if (!sc.hasNext()) {
break;
}
int n = line.length();
int[][] array = new int[n + 1][(n / 2) + 1];
array[0][0] = 1;
int m = (n / 2) + 1;
for (int l = 1; l <= n; l++) {
for (int p = 0; p < m; p++) {
int count1 = 0;
int count2 = 0;
if (p - 1 >= 0) {
count1 = array[l - 1][p - 1];
}
if (p + 1 < m) {
count2 = array[l - 1][p + 1];
}
if (line.charAt(l - 1) == '.') {
array[l][p] = (count1 + count2) % 1000000;
} else if (line.charAt(l - 1) == '(') {
array[l][p] = count1;
} else {
array[l][p] = count2;
}
}
}
System.
out.
println(array
[n
][0]); }
}
}