import java.util.Scanner;

/**
 * Created by sherif on 31/01/16.
 */
public class Young {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String res = "NO";

        int num = in.nextInt();
        Integer[][] arr = new Integer[num][num];

        if (num >= 1 && num <= 100) {
            for (int i = 0; i < num; ++i) {
                for (int j = 0; j < num; ++j) {
                    int d = in.nextInt();
                    if (d >= -100 && d <= 100) {
                        arr[i][j] = d;
                    }
                }
            }
        }

        int d = 0;
        for (int i = 0; i < num; ++i) {
            for (int j = 0; j < num; ++j) {
                d += arr[j][i];
                if (j == num - 1 && d == 0)
                    res = "YES";
            }
        }
        System.out.println(res);
    }
}


import java.util.Scanner;

/**
 * Created by sherif on 31/01/16.
 */
public class Yung {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String res =  "NO";

        int num = in.nextInt();
        Integer[][] arr = new Integer[num][num];

        if (num >= 1 && num <= 100) {
            for (int i = 0; i < num; ++i) {
                for (int j = 0; j < num; ++j) {
                    int d = in.nextInt();
                    if (d >= -100 && d <= 100) {
                        arr[i][j] = d;
                    }
                }
            }
        }

        int d = 0;
        for (int i = 0; i < num; ++i) {
            for (int j = 0; j < num; ++j) {
                d += arr[j][i];
                if (j == num - 1 && d == 0)
                    res = "YES";
            }
        }
        System.out.println(res);
    }
}


import java.util.Scanner;

/**
 * Created by sherif on 31/01/16.
 */
public class Yung {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String res =  "NO";

        int num = in.nextInt();
        Integer[][] arr = new Integer[num][3];

        if (num >= 1 && num <= 100) {
            for (int i = 0; i < num; i++) {
                for (int j = 0; j < 3; j++) {
                    int d = in.nextInt();
                    if (d >= -100 && d <= 100) {
                        arr[i][j] = d;
                    }
                }
            }
        }

        int d = 0;
        for (int i = 0; i < num; ++i) {
            for (int j = 0; j < 3; ++j) {
                d += arr[j][i];
                if (i == num - 1)
                    if (d != 0) {
                        res = "NO";
                        break;
                    } else
                    res = "YES";
            }
        }
        System.out.println(res);
    }
}


import java.util.Scanner;

/**
 * Created by sherif on 31/01/16.
 */
public class Yung {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String res =  "NO";

        int num = in.nextInt();
        Integer[][] arr = new Integer[num][3];

        if (num >= 1 && num <= 100) {
            for (int i = 0; i < num; i++) {
                for (int j = 0; j < 3; j++) {
                    int d = in.nextInt();
                    if (d >= -100 && d <= 100) {
                        arr[i][j] = d;
                    }
                }
            }
        }

        int d = 0;
        for (int i = 0; i < num; ++i) {
            for (int j = 0; j < 3; ++j) {
                d += arr[i][j];
                if (i == num - 1 && d == 0)
                    res = "YES";
            }
        }
        System.out.println(res);
    }
}


import java.util.Scanner;

/**
 * Created by sherif on 31/01/16.
 */
public class Yung {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String res =  "NO";

        int num = in.nextInt();
        Integer[][] arr = new Integer[num][3];

        if (num >= 1 && num <= 100) {
            for (int i = 0; i < num; i++) {
                for (int j = 0; j < 3; j++) {
                    int d = in.nextInt();
                    if (d >= -100 && d <= 100) {
                        arr[i][j] = d;
                    }
                }
            }
        }

        int d = 0;
        outer:
        for (int j = 0; j < 3; ++j) {
            for (int i = 0; i < num; ++i) {
                d += arr[i][j];
                if (i == num - 1)
                    if (d != 0) {
                        res = "NO";
                        break outer;
                    } else
                    res = "YES";
            }
        }
        System.out.println(res);
    }
}


import java.util.Scanner;

/**
 * Created by sherif on 31/01/16.
 */
public class Yung {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String res =  "NO";

        int num = in.nextInt();
        Integer[][] arr = new Integer[num][num];

        if (num >= 1 && num <= 100) {
            for (int i = 0; i < num; ++i) {
                for (int j = 0; j < 3; ++j) {
                    int d = in.nextInt();
                    if (d >= -100 && d <= 100) {
                        arr[i][j] = d;
                    }
                }
            }
        }

        int d = 0;
        for (int i = 0; i < num; ++i) {
            for (int j = 0; j < 3; ++j) {
                d += arr[i][j];
                if (i == num - 1 && d == 0)
                    res = "YES";
            }
        }
        System.out.println(res);
    }
}


import java.util.Scanner;

public class main{

    public static void main(String[] args) {

 Scanner s = new Scanner(System.in);

 int n=s.nextInt();
 int x=0,y=0,z=0;

        for (int i = 1; i <=n; i++) {
            x+=s.nextInt();
            y+=s.nextInt();
            z+=s.nextInt();
        }

       if(x==0&&y==0&&z==0)
            System.out.println("YES");
       else
            System.out.println("NO");

    }

}


import java.util.Scanner;

public class main{

    public static void main(String[] args) {

 Scanner s = new Scanner(System.in);

 int n=s.nextInt();

 int arr[]=new int[n];
 int x,y,z,sum=0;

        for (int i = 0; i <arr.length; i++) {

            x=s.nextInt();
            y=s.nextInt();
            z=s.nextInt();

            sum=x+y+z;
            arr[i]=sum;
        }

        int sumall=0;

        for (int i = 0; i < arr.length; i++)
            sumall+=arr[i];

        if(sumall!=0)
            System.out.println("NO");
        else
            System.out.println("YES");

    }

}


import java.util.Scanner;

public class main{

    public static void main(String[] args) {

 Scanner s = new Scanner(System.in);

 int n=s.nextInt();
 int x=0,y=0,z=0;

        for (int i = 1; i <=n; i++) {
            x+=s.nextInt();
            y+=s.nextInt();
            z+=s.nextInt();
        }

       if(x==0&&y==0&&z==0)
            System.out.println("YES");
       else

            System.out.println("NO");

    }

}


import java.util.Scanner;

public class main{

    public static void main(String[] args) {

 Scanner s = new Scanner(System.in);

 int n=s.nextInt();
 int x=0,y=0,z=0;

        for (int i = 1; i <=n; i++) {
            x+=s.nextInt();
            y+=s.nextInt();
            z+=s.nextInt();
        }

       if(x==0&&y==0&&z==0)
            System.out.println("YES");

       else
            System.out.println("NO");

    }

}


import java.util.Scanner;

public class main{

    public static void main(String[] args) {

 Scanner s = new Scanner(System.in);

 int n=s.nextInt();

 int x,y,z,sum=0;
 boolean b=true;

        for (int i = 1; i <=n; i++) {

            x=s.nextInt();
            y=s.nextInt();
            z=s.nextInt();

            sum=x+y+z;
            if(sum!=0)
            {
                System.out.println("NO");
                b=false;
                break;
            }

        }

        if(b)
            System.out.println("YES");

    }

}


import java.util.Scanner;

public class other {

    public static class Vector{
        int x=0,y=0,z=0;

        public Vector(int X, int Y, int Z){
            this.x = X;
            this.y = Y;
            this.z = Z;
        }
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        try{
        Vector[] vect = new Vector[N];

        for(int i = 0; i < N; i++){
            int x = scan.nextInt();
            int y = scan.nextInt();
            int z = scan.nextInt();
            vect[i] = new Vector(x, y, z);
        }

        int sumX = 0;
        int sumY = 0;
        int sumZ = 0;
        for(int i = 0; i<N; i++){
            sumX+=vect[i].x;
            sumY+=vect[i].y;
            sumZ+=vect[i].z;
        }

        if(sumX == 0 && sumY == 0 && sumZ == 0)
            System.out.println("YES");
        else
            System.out.println("NO");
        }catch(Exception e){
            e.printStackTrace();
        }
    }

}


import java.util.Scanner;

public class other {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan = new Scanner(System.in);

        byte N = scan.nextByte();
        int sum = 0;
        for (int i = 0; i < N; i++) {
            sum += scan.nextInt();
            sum += scan.nextInt();
            sum += scan.nextInt();
        }

        if (sum == 0)
            System.out.println("YES");
        else
            System.out.println("NO");

    }

}


import java.util.Scanner;

public class other {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int sum = 0;
        for (int i = 0; i < N; i++) {
            sum += scan.nextInt();
            sum += scan.nextInt();
            sum += scan.nextInt();
        }

        if (sum == 0)
            System.out.println("YES");
        else
            System.out.println("NO");

    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Porya
 */
import java.util.*;
public class YoungPhysicist {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc=new Scanner(System.in);
        int n;
        int x=0;
        int y=0;
        int z=0;
        n=sc.nextInt();
        for(int i=0;i<n;i++)
        {
            x=sc.nextInt();
            y=sc.nextInt();
            z=sc.nextInt();
        }

        if(x==0&&y==0&&z==0)
        {
            System.out.println("YES");
        }
        else
            System.out.println("NO");
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Porya
 */
import java.util.*;
public class YoungPhysicist {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc=new Scanner(System.in);
        int n;
        int x=0;
        int y=0;
        int z=0;
        n=sc.nextInt();
        for(int i=0;i<n;i++)
        {
            x+=sc.nextInt();
            y+=sc.nextInt();
            z+=sc.nextInt();
        }

        if(x==0&&y==0&&z==0)
        {
            System.out.println("YES");
        }
        else
            System.out.println("NO");
    }

}


import java.util.*;
import java.io.*;

public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
        int a = Integer.parseInt(br.readLine());
        int[][] v = new int[a][3];
        int al = 0;
        int bl = 0;
        int cl = 0;
        for(int i = 0;i<a;i++){
            String[] z = br.readLine().split(" ");
            v[i][0] = Integer.parseInt(z[0]);
            v[i][1] = Integer.parseInt(z[1]);
            v[i][2] = Integer.parseInt(z[2]);
            al += v[i][0];
            bl += v[i][1];
            cl += v[i][2];
        }
        if(al==bl && bl==cl){
            pw.println("YES");
        }
        else{
            pw.println("NO");
        }
        pw.close();
    }
}


import java.util.*;
import java.io.*;

public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
        int a = Integer.parseInt(br.readLine());
        int[][] v = new int[a][3];
        int al = 0;
        int bl = 0;
        int cl = 0;
        boolean why = true;
        for(int i = 0;i<a;i++){
            String[] z = br.readLine().split(" ");
            v[i][0] = Integer.parseInt(z[0]);
            v[i][1] = Integer.parseInt(z[1]);
            v[i][2] = Integer.parseInt(z[2]);
            al += v[i][0];
            bl += v[i][1];
            cl += v[i][2];
            if(v[i][0]==0 && v[i][1]==0 && v[i][2]==0){
                why = false;
            }
        }
        if(al==bl && bl==cl && why){
            pw.println("YES");
        }
        else{
            pw.println("NO");
        }
        pw.close();
    }
}


import java.util.*;
import java.io.*;

public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
        int a = Integer.parseInt(br.readLine());
        int[][] v = new int[a][3];
        int al = 0;
        int bl = 0;
        int cl = 0;
        boolean why = true;
        HashSet<Integer> as = new HashSet<Integer>();
        for(int i = 0;i<a;i++){
            String[] z = br.readLine().split(" ");
            v[i][0] = Integer.parseInt(z[0]);
            v[i][1] = Integer.parseInt(z[1]);
            v[i][2] = Integer.parseInt(z[2]);
            al += v[i][0];
            bl += v[i][1];
            cl += v[i][2];
            if(v[i][0]==0 && v[i][1]==0 && v[i][2]==0){
                why = false;
            }
            as.add(v[i][0]);
            as.add(v[i][1]);
            as.add(v[i][2]);
        }

        if(al==bl && bl==cl && (why || as.size()==1)){
            pw.println("YES");
        }
        else{
            pw.println("NO");
        }
        pw.close();
    }
}


import java.util.Scanner;

/**
 *
 * @author Mohd
 */
public class YoungPhysicist {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int []x=new int[n];
        int []y=new int[n];
        int []z=new int[n];
        int s1=0,s2=0,s3=0;
        for(int i=0;i<n;i++)
        {
            x[i]=sc.nextInt();
            s1+=x[i];
            y[i]=sc.nextInt();
            s2+=y[i];
            z[i]=sc.nextInt();
            s3+=z[i];
        }
        if(s1==0&&s2==0&&s3==0)
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import java.util.Scanner;

/**
 *
 * @author Mohd
 */
public class YoungPhysicist {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int []x=new int[n];
        int []y=new int[n];
        int []z=new int[n];
        int s1=0,s2=0,s3=0;
        for(int i=0;i<n;i++)
        {
            x[i]=sc.nextInt();
            s1+=x[i];
            y[i]=sc.nextInt();
            s2+=y[i];
            z[i]=sc.nextInt();
            s3+=z[i];
        }
        if(s1+s2+s3==0)
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import java.util.Scanner;

public class Problem69A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();

		int[][] arr = new int[num][3];

		int sum = 0;
		int value = 0;
		for(int i=0; i<num; i++)
		{
			for(int j=0; j<3; j++)
			{
				value = scan.nextInt();
				arr[i][j] = value;
			}
		}

		for(int i=0; i<num; i++)
		{
			for(int j=0; j<3; j++)
			{
				sum +=	arr[i][j];
			}
		}

		if(sum == 0) System.out.println("YES");
		else	System.out.println("NO");

	}
}


import java.util.Scanner;

public class Problem69A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();

		int[][] arr = new int[num][3];

		int sum = 0;
		int value = 0;
		for(int i=0; i<num; i++)
		{
			for(int j=0; j<3; j++)
			{
				arr[i][j] =scan.nextInt();
			}
		}

		int[] col = new int[3];

		for(int i=0; i<3; i++)
		{
			for(int j=0; j<num; j++)
			{
				col[i] += arr[j][i];
			}
		}

		if(col[0]==0 && col[1]==0 && col[2]==0)
		 System.out.println("YES");
		else	System.out.println("NO");

	}
}


import java.util.Scanner;

public class Problem69A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();

		int[][] arr = new int[num][3];

		int sum = 0;
		int value = 0;
		for(int i=0; i<num; i++)
		{
			for(int j=0; j<3; j++)
			{
				arr[i][j] =scan.nextInt();
			}
		}

		int[] col = new int[3];

		for(int i=0; i<3; i++)
		{
			for(int j=0; j<num; j++)
			{
				col[i] += arr[i][j];
			}
		}

		if(col[0]==0 && col[1]==0 && col[2]==0)
		 System.out.println("YES");
		else	System.out.println("NO");

	}
}


import java.util.Scanner;

public class Problem69A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();

		int[][] arr = new int[num][3];

		int sum = 0;
		int value = 0;
		for(int i=0; i<num; i++)
		{
			for(int j=0; j<3; j++)
			{
				value = scan.nextInt();
				arr[i][j] = value;
				sum+=value;
			}
		}

		if(sum == 0) System.out.println("YES");
		else	System.out.println("NO");

	}
}


import java.util.Scanner;
/**
 *
 * @author Simran
 */
public class Young1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner s = new Scanner(System.in);
        int n= s.nextInt();
        int a[][] = new int[n][3];
        for(int rows=0;rows<n;rows++){
         for(int columns=0;columns<3;columns++){
         a[rows][columns]=s.nextInt();
         }

        }
        int sum1=0,sum2=0,sum3=0;
        for(int i=0;i<n;i++){
        sum1 = sum1+a[i][0];
        }

        for(int i=0;i<n;i++){
        sum2 = sum2+a[i][1];
        }

        for(int i=0;i<n;i++){
        sum3 = sum3+a[i][2];
        }

        if(sum1==0&&sum2==0&&sum3==0){
       System.out.println("YES");

        }
        else{
        System.out.println("NO");
        }
            }

}


import java.util.Scanner;

/**
 *
 * @author Simran
 */
public class Young {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,counter=0;
         Scanner sc = new Scanner(System.in);
         n= sc.nextInt();
        int a[][]= new int[n][3];
       int sum[]= new int[3];

        for(int x =0; x<3;x++){
        for(int y=0;y<n;y++){
        a[x][y] = sc.nextInt();
        }
        }

         for(int y=0;y<n;y++){
        for(int x =0; x<3;x++){
          sum[y] += a[x][y];

        }
        if(sum[y]==0){
        counter++;
        }
         }

       if(counter==3){
       System.out.println("YES");
        }
       else{
       System.out.println("NO");
       }
    }

}


import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main {
    static void solve(InputReader reader, OutputWriter writer)
            throws IOException {
        // Scanner scan = new Scanner(System.in);
        String a = reader.readLine();
        int n = Integer.parseInt(a);
        int sumX = 0, sumY = 0, sumZ = 0;
        for (int i = 0; i < n; ++i) {
            String s = reader.readLine();
            String[] split = s.split(" ");

            int x = Integer.parseInt(split[0]);
            int y = Integer.parseInt(split[1]);
            int z = Integer.parseInt(split[2]);
            sumX += x;
            sumY += y;
            sumZ += z;

        }
        if (sumX == 0 && sumY == 0 && sumZ == 0)
            writer.println("YES");
        else
            writer.println("NO");
    }

    public static void main(String[] args) throws Exception {
        InputReader reader = new InputReader(System.in);
        OutputWriter writer = new OutputWriter(System.out);
        try {
            solve(reader, writer);
        } catch (Exception e) {
            e.printStackTrace(System.out);
        } finally {
            writer.close();
        }
    }

}

class InputReader extends BufferedReader {
    public InputReader(InputStream in) {
        super(new InputStreamReader(in));
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(PrintStream out) {
        super(new BufferedWriter(new OutputStreamWriter(out)));
    }
}


import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main {
    static void solve(InputReader reader, OutputWriter writer)
            throws IOException {
        // Scanner scan = new Scanner(System.in);
        String a = reader.readLine();
        int n = Integer.parseInt(a);
        int sum = 0;
        for (int i = 0; i < n; ++i) {
            String s = reader.readLine();
            String[] split = s.split(" ");

            int x = Integer.parseInt(split[0]);
            int y = Integer.parseInt(split[1]);
            int z = Integer.parseInt(split[2]);
            sum += x + y + z;

        }
        if(sum == 0)
            writer.println("YES");
        else
            writer.println("NO");
    }

    public static void main(String[] args) throws Exception {
        InputReader reader = new InputReader(System.in);
        OutputWriter writer = new OutputWriter(System.out);
        try {
            solve(reader, writer);
        } catch (Exception e) {
            e.printStackTrace(System.out);
        } finally {
            writer.close();
        }
    }

}

class InputReader extends BufferedReader {
    public InputReader(InputStream in) {
        super(new InputStreamReader(in));
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(PrintStream out) {
        super(new BufferedWriter(new OutputStreamWriter(out)));
    }
}


import java.util.*;
public class YoungPhysicist {
    public static void main(String args[]){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for(int i = 0; i < n;i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int z = sc.nextInt();
            ans = x + y + z + ans;
        }
        System.out.println(ans == 0?"YES": "NO");
    }
}


import java.util.*;
public class YoungPhysicist {
    public static void main(String args[]){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int x = 0;
        int y = 0;
        int z = 0;
        for(int i = 1; i <= n;i++){
            x = sc.nextInt() + x;
            y = sc.nextInt() + y;
            z = sc.nextInt() + z;
        }
        System.out.println((x == 0 && y == 0 && z == 0)? "YES": "NO");
    }
}


import java.util.Scanner;

public class A_Young_Physicist {
	static Scanner input = new Scanner(System.in);

	public static void main(String[] args) {
		int n = input.nextInt();
		int[][] arr = new int[n][n];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				arr[i][j] = input.nextInt();
			}
		}
		int count = 0;
		for (int i = 0; i < n; i++) {
			int sum = 0;
			for (int j = 0; j < n; j++) {
				sum += arr[j][i];
			}
			if (sum == 0)
				count++;
		}
		if (count == 3)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}


import java.util.Scanner;

public class A_Young_Physicist {
	static Scanner input = new Scanner(System.in);

	public static void main(String[] args) {
		int n = input.nextInt();
		int[][] arr = new int[n][3];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				arr[i][j] = input.nextInt();
			}
		}
		int count = 0;
		for (int i = 0; i < 3; i++) {
			int sum = 0;
			for (int j = 0; j < n; j++) {
				sum += arr[j][i];
			}
			if (sum == 0)
				count++;
		}
		if (count == 3)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}


import java.util.Scanner;

public class Young_Physicist {
    public static void main(String args[]){
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int count = 0 , temp = 0;
            for(int i=0 ; i < n ; i++)
                for(int j=0 ; j < 3 ; j++){
                    temp = in.nextInt();
                    count+=temp;
                }
            if(count==0)
                System.out.println("YES");
            else
                System.out.println("NO");
    }
}


import java.util.Scanner;

public class Young_Physicist {
	public static void main(String args[]){
			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			int count = 0 , temp = 0;
			for(int i=0 ; i < n ; i++)
				for(int j=0 ; j < n ; j++){
					temp = in.nextInt();
					count+=temp;
				}
			if(count==0)
				System.out.println("YES");
			else
				System.out.println("NO");
	}
}


import java.util.Scanner;

public class Young_Physicist {
    public static void main(String args[]){
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int count = 0 , a = 0 , b = 0 , c = 0 , temp = 0 ;
            for(int i=0 ; i < n ; i++){
                    a += in.nextInt();
                    b += in.nextInt();
                    c += in.nextInt();
                }
            boolean a1, b1,c1;
            a%=2;
            b%=2;
            c%=2;
            if(a==1)
                a1=true;
            else
                a1=false;
            if(a==1)
                b1=true;
            else
                b1=false;
            if(a==1)
                c1=true;
            else
                c1=false;
            if(a1||b1||c1)
                System.out.println("NO");
            else
                System.out.println("YES");
    }
}


import java.util.Scanner;

public class Young_Physicist {
    public static void main(String args[]){
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int count = 0 , a = 0 , b = 0 , c = 0 , temp = 0 ;
            for(int i=0 ; i < n ; i++){
                    a += in.nextInt();
                    b += in.nextInt();
                    c += in.nextInt();
                }
            if(a==0&&b==0&&c==0)
                System.out.println("YES");
            else
                System.out.println("NO");
    }
}


import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int matrix[][] = new int[n][3];
		for(int row = 0;row<n;++row){
			for(int col = 0;col<3;++col){
				matrix[row][col] = sc.nextInt();
			}
		}
		int ok = 1;
		for(int row = 0;ok==1&&row<3;++row){
			int sum = 0;
			for(int col = 0;col<n;++col){
				sum+=matrix[col][row];
			}
			if(sum!=0){
				ok = 0;
				break;
			}
		}
		if(ok==1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}

}


import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int matrix[][] = new int[n][n],x;
		for(int row = 0;row<n;++row){
			for(int col = 0;col<n;++col){
				matrix[row][col] = sc.nextInt();
			}
		}
		int ok = 1;
		for(int row = 0;ok==1&&row<n;++row){
			int sum = 0;
			for(int col = 0;col<n;++col){
				sum+=matrix[col][row];
			}
			if(sum!=0){
				ok = 0;
				break;
			}
		}
		if(ok==1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}

}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        int sum1=0 , count=0;
        int[][]array=new int[n][3];
        int[]sum=new int[3];
        for(int i=0 ; i<n ; i++){
            for(int j=0 ; j<array[i].length ; j++)
            array[i][j]=input.nextInt();
        }//End for
        for(int i=0 ; i<3 ; i++){
            for(int j=0 ; j<n ; j++)
              sum1+=array[j][i];
            sum[i]=sum1;
            if(sum[i]==0)
                count++;
        }//End for
        if(count==3)
            System.out.println("YES");
        else
            System.out.println("NO");
    }//End main
} //End class


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        int sum=0;
        for(int i=0 ; i<n*n ; i++)
            sum+=input.nextInt();
        if(sum==0)
            System.out.println("YES");
        else
            System.out.println("NO");
            }//End main
}//End class


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        int sum=0;
        for(int i=0 ; i<n*3 ; i++)
            sum+=input.nextInt();
        if(sum==0)
            System.out.println("YES");
        else
            System.out.println("NO");
            }//End main
}//End class


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        int sum=0 , count=0;
        int[]array=new int[n];
        for(int i=0 ; i<n ; i++){
            sum=0;
            int num1=input.nextInt();
            int num2=input.nextInt();
            int num3=input.nextInt();
            sum=num1+num2+num3;
            array[i]=sum;
            if(array[i]==0)
                count++;
        }//End for
        if(count==n)
            System.out.println("YES");
        else
            System.out.println("NO");
    }//End main
}//End class


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        int sum1=0 , count=0;
        int[][]array=new int[n][3];
        int[]sum=new int[n];
        for(int i=0 ; i<n ; i++){
            for(int j=0 ; j<array[i].length ; j++)
            array[i][j]=input.nextInt();
        }//End for
        for(int i=0 ; i<n ; i++){
            for(int j=0 ; j<array[i].length ; j++)
              sum1+=array[j][i];
            sum[i]=sum1;
            if(sum[i]==0)
                count++;
        }//End for
        if(count==n)
            System.out.println("YES");
        else
            System.out.println("NO");
    }//End main
} //End class


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author hp
 */
public class young {
     public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int m=sc.nextInt();
        int a[][]=new int[m][m];
      int y=1;
        int s=0;
        int b[]=new int[m];
        for(int i=0;i<m;i++){

            for(int j=0;j<m;j++){
                       int n=sc.nextInt();
                       a[i][j]=n;

            }
        }
        for(int i=0;i<m;i++){
            b[i]=s;
            s=0;
            for(int j=0;j<m;j++){
               s=s+ a[j][i];
            }
        }
        for(int i=0;i<m-1;i++){
            if(b[i]==b[i+1]){
              y++;
            }

            }
        if(y==m){
            System.out.print("YES");
        }
        else{
                        System.out.print("NO");

        }

     }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author hp
 */
public class young {
     public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int m=sc.nextInt();
        int a[][]=new int[m][m];
      int y=0;
        int s=0;
        int b[]=new int[m];
        for(int i=0;i<m;i++){

            for(int j=0;j<m;j++){
                       int n=sc.nextInt();
                       a[i][j]=n;

            }
        }
        for(int i=0;i<m;i++){
            b[i]=s;
            s=0;
            for(int j=0;j<m;j++){
               s=s+ a[j][i];
            }
        }
        for(int i=0;i<m;i++){
            if(b[i]==0){
              y++;
            }

            }
        if(y==m){
            System.out.print("YES");
        }
        else{
                        System.out.print("NO");

        }

     }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author hp
 */

public class young {
     public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int m=sc.nextInt();
        int a[][]=new int[m][3];
      int y=0;
        int s=0;
        int b[]=new int[3];
        for(int i=0;i<m;i++){

            for(int j=0;j<3;j++){
                       int n=sc.nextInt();
                       a[i][j]=n;

            }
        }
        for(int i=0;i<3;i++){
            b[i]=s;
            s=0;
            for(int j=0;j<m;j++){
               s=s+ a[j][i];
            }
        }
        for(int i=0;i<3;i++){
            if(b[i]==0){
              y++;
            }

            }
        if(y==3){
            System.out.println("YES");
        }
        else{
                        System.out.println("NO");

        }

     }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author hp
 */

public class young {
     public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int m=sc.nextInt();
        int a[][]=new int[m][3];
      int y=0;
        int s=0;
        int b[]=new int[3];
        for(int i=0;i<m;i++){

            for(int j=0;j<3;j++){
                       int n=sc.nextInt();
                       a[i][j]=n;

            }
        }
        for(int i=0;i<3;i++){
            b[i]=s;
            s=0;
            for(int j=0;j<m;j++){
               s=s+ a[j][i];
            }
        }
        for(int i=0;i<3;i++){
            if(b[i]==0){
              y++;
            }

            }
        if(y==3){
            System.out.println("YES");
        }
        else{
                        System.out.println("NO");

        }

     }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class YoungPhysicist
{
    public static void main(String arg[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        int a = 0;
        int b = 0;
        int c = 0;
        while (number-- > 0)
        {
            String forceLine[] = br.readLine().split(" ");
            a += Integer.parseInt(forceLine[0]);
            b += Integer.parseInt(forceLine[1]);
            c += Integer.parseInt(forceLine[2]);
        }
        if (a == 0 && b == 0 && c == 0)
        {
            System.out.println("YES");
        } else
        {
            System.out.println("NO");
        }

    }
}


//package Codeforces.Div2A_63.Code1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/*
 * some cheeky quote
 */

public class Main
{
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException
    {
        int n = in.nextInt();
        int a = 0;
        int b = 0;
        int c = 0;
        for (int i = 0; i < n; i++)
        {
            a += in.nextInt();
            b += in.nextInt();
            c += in.nextInt();
        }

        if (a == b && b == c && c == 0)
        {
            System.out.println("YES");
            return;

        }
        System.out.println("NO");

    }

    public void run()
    {
        try
        {
            in = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    class FastScanner
    {
        BufferedReader br;
        StringTokenizer st;

        FastScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }

    public static void main(String[] arg)
    {
        new Main().run();
    }
}


import java.util.Scanner;

public class young_physicist {

  public static void main(String args[])
  {

  Scanner scan=new Scanner(System.in);
  int n=scan.nextInt();
  int x[]=new int[n];
 int[]y =new int[n];
 int[]z =new int[n];
 int sumx=0;
  int sumy=0;
  int sumz=0;
  for(int i=0;i<n;i++)
  {

  x[i]=scan.nextInt();
   y[i]=scan.nextInt();

  z[i]=scan.nextInt();

  sumx=sumx+x[i];
  sumy=sumy+y[i];
  sumz=sumz+z[i];
  }

  if(sumx==0&&sumy==0&&sumz==0)

  System.out.println("yes");
  else
  System.out.println("no");

  }

}


import java.util.Scanner;

public class young_physicist {

  public static void main(String args[])
  {

  Scanner scan=new Scanner(System.in);
  int n=scan.nextInt();
  int x[]=new int[n];
 int[]y =new int[n];
 int[]z =new int[n];
 int sumx=0;
  int sumy=0;
  int sumz=0;
  for(int i=0;i<n;i++)
  {

  x[i]=scan.nextInt();
   y[i]=scan.nextInt();

  z[i]=scan.nextInt();

  sumx=sumx+x[i];
  sumy=sumy+y[i];
  sumz=sumz+z[i];
  }

  if(sumx==0&&sumy==0&&sumz==0)

  System.out.println("YES");
  else
  System.out.println("NO");

  }

}


import java.util.*;

public class Sheet1_ProbSolving {

    public static int EX1(){
        int sum=0;
        int [][] arr = new int [100][100];
        Scanner reader = new Scanner(System.in);
        int x=reader.nextInt();
        for (int i=0;i<x;i++){
            for (int j=0;j<x;j++){
                arr[i][j]=reader.nextInt();
                sum+=arr[i][j];
            }
        }
        return sum;

    }

    public static void main(String[] args) {
        if (EX1()==0){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }

    }

}


import java.util.*;

public class Sheet1_ProbSolving {

    public static void main(String[] args) {
         int sum=0;
        int [][] arr = new int [100][100];
        Scanner reader = new Scanner(System.in);
        int x=reader.nextInt();
        for (int i=0;i<x;i++){
            for (int j=0;j<3;j++){
                arr[i][j]=reader.nextInt();
                sum+=arr[i][j];
            }
        }
        if (sum==0){
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }

         }

}


import java.util.*;

public class Sheet1_ProbSolving {

    public static void main(String[] args) {

        int n ,x,y,z,a=0,b=0,c=0;
        Scanner reader = new Scanner(System.in);
        n = reader.nextInt();
        while (n!=0){
            x = reader.nextInt();
            y = reader.nextInt();
            z = reader.nextInt();
            a+=x;
            b+=y;
            c+=z;
        }
         if(a==0 && b==0 && c==0)
             System.out.println("YES");
    else
             System.out.println("NO");
    }

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
ll pre[N];
ll suf[N];
ll fac[N];
ll inv[N];
ll ans;
ll n;

string t;

void input() {
    cin >> t;
    n = len(t);
}

ll fpow(ll b, ll p = mod - 2) {
    ll res = 1;
    ll pow = b;
    while(p) {
        if(p & 1) {
            res *= pow;
            res %= mod;
        }
        pow *= pow;
        pow %= mod;
        p >>= 1;
    }
    return res;
}

void calc_fac() {
    fac[0] = inv[0] = 1;
    for(ll i = 1; i < N; ++i) {
        fac[i] = 1ll * fac[i - 1] * i % mod;
        inv[i] = fpow(fac[i]);
    }
}

ll bin(ll a, ll b) {
    return 1ll * fac[a] * inv[b] % mod * inv[a - b] % mod;
}

void solve() {
    calc_fac();
    for(ll i = 0; i < n; ++i) {
        pre[i] = (i? pre[i - 1]: 0) + (t[i] == '(');
    }
    for(ll i = n - 1; i >= 0; --i) {
        suf[i] = suf[i + 1] + (t[i] == ')');
    }
    for(ll i = 0; i < n; ++i) {
        if(t[i] == '(') {
            ll x = pre[i] - 1;
            ll y = suf[i];
            ans += bin(x + y, x + 1);
            ans %= mod;
        }
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll model=1e9+7;
char ch[200100];
ll suml[200100];
ll sumr[200100];
ll temp[200100];
//map< pair<int,int>,ll >p;
//ll getans(ll a,ll b){
//	if(p[pair<int,int>(a,b)])
//		return p[pair<int,int>((int)a,(int)b)];
//	if(a==b||b==0)
//		return p[pair<int,int>(a,b)]=1;
//	else
//		return p[pair<int,int>(a,b)]=(getans(a-1,b)%model+getans(a-1,b-1)%model)%model;
//}
ll pow(ll a,ll b){
  	ll t,y;
	t=1;
	y=a;
  	while(b!=0){
    	if(b&1==1)
			t=t*y%model;
    	y=y*y%model;
		b=b>>1;
  	}
  	return t;
}
int main(){
	scanf("%s",ch);
	ll ans=0;
	memset(suml,0,sizeof(suml));
	memset(sumr,0,sizeof(sumr));
	memset(temp,0,sizeof(temp));
	int len=strlen(ch);
	temp[1]=1;
	for(ll i=2;i<=len;i++){
		temp[i]=(i*temp[i-1])%model;
	}
	for(int i=0;i<len;i++){
		if(ch[i]=='('&&i==0){
			suml[i]++;
		}
		else if(ch[i]==')'&&i==0){
			sumr[i]++;
		}
		else if(ch[i]=='('){
			suml[i]=suml[i-1]+1;
			sumr[i]=sumr[i-1];
		}
		else if(ch[i]==')'){
			sumr[i]=sumr[i-1]+1;
			suml[i]=suml[i-1];
		}
	}
	for(int i=0;i<len-1;i++){
		if(ch[i]==')')
			continue;
		ll mn=min(suml[i],sumr[len-1]-sumr[i]);
//		for(int j=1;j<=mn;j++){
//			ans+=(getans(suml[i]-1,suml[i]-j)%model)*(getans(sumr[len-1]-sumr[i],sumr[len-1]-sumr[i]-j)%model);
//			ans%=model;
//		}
//		ans+=getans(suml[i]+sumr[len-1]-sumr[i]-1,min(suml[i],sumr[len-1]-sumr[i]-1));
		if(mn==0)
			ans+=0;
		else if(temp[suml[i]]==0||temp[sumr[len-1]-sumr[i]-1]==0)
			ans+=1;
		else
			ans+=(temp[suml[i]+sumr[len-1]-sumr[i]-1]*pow(temp[suml[i]],model-2))%model*pow(temp[sumr[len-1]-sumr[i]-1],model-2);
//		cout<<temp[suml[i]+sumr[len-1]-sumr[i]-1]<<" "<<temp[suml[i]]<<" "<<temp[sumr[len-1]-sumr[i]-1]<<endl;
//		cout<<ans<<endl;
		ans%=model;
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll model=1e9+7;
char ch[200100];
ll suml[200100];
ll sumr[200100];
ll temp[200100];
//map< pair<int,int>,ll >p;
//ll getans(ll a,ll b){
//	if(p[pair<int,int>(a,b)])
//		return p[pair<int,int>((int)a,(int)b)];
//	if(a==b||b==0)
//		return p[pair<int,int>(a,b)]=1;
//	else
//		return p[pair<int,int>(a,b)]=(getans(a-1,b)%model+getans(a-1,b-1)%model)%model;
//}
ll pow(ll a,ll b){
  	ll t,y;
	t=1;
	y=a;
  	while(b!=0){
    	if(b&1==1)
			t=t*y%model;
    	y=y*y%model;
		b=b>>1;
  	}
  	return t;
}
int main(){
	scanf("%s",ch);
	ll ans=0;
	memset(suml,0,sizeof(suml));
	memset(sumr,0,sizeof(sumr));
	memset(temp,0,sizeof(temp));
	int len=strlen(ch);
	temp[1]=1;
	for(ll i=2;i<=len;i++){
		temp[i]=(i*temp[i-1])%model;
	}
	for(int i=0;i<len;i++){
		if(ch[i]=='('&&i==0){
			suml[i]++;
		}
		else if(ch[i]==')'&&i==0){
			sumr[i]++;
		}
		else if(ch[i]=='('){
			suml[i]=suml[i-1]+1;
			sumr[i]=sumr[i-1];
		}
		else if(ch[i]==')'){
			sumr[i]=sumr[i-1]+1;
			suml[i]=suml[i-1];
		}
	}
	for(int i=0;i<len-1;i++){
		if(ch[i]==')')
			continue;
		ll mn=min(suml[i],sumr[len-1]-sumr[i]);
//		for(int j=1;j<=mn;j++){
//			ans+=(getans(suml[i]-1,suml[i]-j)%model)*(getans(sumr[len-1]-sumr[i],sumr[len-1]-sumr[i]-j)%model);
//			ans%=model;
//		}
//		ans+=getans(suml[i]+sumr[len-1]-sumr[i]-1,min(suml[i],sumr[len-1]-sumr[i]-1));

//		if(temp[suml[i]]==0||temp[sumr[len-1]-sumr[i]-1]==0)
//			ans+=1;
//		else
			ans+=(temp[suml[i]+sumr[len-1]-sumr[i]-1]*pow(temp[suml[i]],model-2))%model*pow(temp[sumr[len-1]-sumr[i]-1],model-2);
//		cout<<temp[suml[i]+sumr[len-1]-sumr[i]-1]<<" "<<temp[suml[i]]<<" "<<temp[sumr[len-1]-sumr[i]-1]<<endl;
//		cout<<ans<<endl;
		ans%=model;
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll model=1e9+7;
char ch[200100];
ll suml[200100];
ll sumr[200100];
ll temp[200100];
//map< pair<int,int>,ll >p;
//ll getans(ll a,ll b){
//	if(p[pair<int,int>(a,b)])
//		return p[pair<int,int>((int)a,(int)b)];
//	if(a==b||b==0)
//		return p[pair<int,int>(a,b)]=1;
//	else
//		return p[pair<int,int>(a,b)]=(getans(a-1,b)%model+getans(a-1,b-1)%model)%model;
//}
ll pow(ll a,ll b){
  	ll t,y;
	t=1;
	y=a;
  	while(b!=0){
    	if(b&1==1)
			t=t*y%model;
    	y=y*y%model;
		b=b>>1;
  	}
  	return t;
}
int main(){
	scanf("%s",ch);
	ll ans=0;
	memset(suml,0,sizeof(suml));
	memset(sumr,0,sizeof(sumr));
	memset(temp,0,sizeof(temp));
	int len=strlen(ch);
	temp[1]=1;
	for(ll i=2;i<=len;i++){
		temp[i]=(i*temp[i-1])%model;
	}
	for(int i=0;i<len;i++){
		if(ch[i]=='('&&i==0){
			suml[i]++;
		}
		else if(ch[i]==')'&&i==0){
			sumr[i]++;
		}
		else if(ch[i]=='('){
			suml[i]=suml[i-1]+1;
			sumr[i]=sumr[i-1];
		}
		else if(ch[i]==')'){
			sumr[i]=sumr[i-1]+1;
			suml[i]=suml[i-1];
		}
	}
	for(int i=0;i<len-1;i++){
		if(ch[i]==')')
			continue;
		ll mn=min(suml[i],sumr[len-1]-sumr[i]);
//		for(int j=1;j<=mn;j++){
//			ans+=(getans(suml[i]-1,suml[i]-j)%model)*(getans(sumr[len-1]-sumr[i],sumr[len-1]-sumr[i]-j)%model);
//			ans%=model;
//		}
//		ans+=getans(suml[i]+sumr[len-1]-sumr[i]-1,min(suml[i],sumr[len-1]-sumr[i]-1));

		if(temp[suml[i]]==0||temp[sumr[len-1]-sumr[i]-1]==0)
			ans+=1;
		else
			ans+=(temp[suml[i]+sumr[len-1]-sumr[i]-1]*pow(temp[suml[i]],model-2))%model*pow(temp[sumr[len-1]-sumr[i]-1],model-2);
//		cout<<temp[suml[i]+sumr[len-1]-sumr[i]-1]<<" "<<temp[suml[i]]<<" "<<temp[sumr[len-1]-sumr[i]-1]<<endl;
//		cout<<ans<<endl;
		ans%=model;
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll model=1e9+7;
char ch[200100];
ll suml[200100];
ll sumr[200100];
ll temp[200100];
//map< pair<int,int>,ll >p;
//ll getans(ll a,ll b){
//	if(p[pair<int,int>(a,b)])
//		return p[pair<int,int>((int)a,(int)b)];
//	if(a==b||b==0)
//		return p[pair<int,int>(a,b)]=1;
//	else
//		return p[pair<int,int>(a,b)]=(getans(a-1,b)%model+getans(a-1,b-1)%model)%model;
//}
ll pow(ll a,ll b){
  	ll t,y;
	t=1;
	y=a;
  	while(b!=0){
    	if(b&1==1)
			t=t*y%model;
    	y=y*y%model;
		b=b>>1;
  	}
  	return t;
}
int main(){
	scanf("%s",ch);
	ll ans=0;
	memset(suml,0,sizeof(suml));
	memset(sumr,0,sizeof(sumr));
	memset(temp,0,sizeof(temp));
	int len=strlen(ch);
	temp[1]=1;
	for(ll i=2;i<=len;i++){
		temp[i]=(i*temp[i-1])%model;
	}
	for(int i=0;i<len;i++){
		if(ch[i]=='('&&i==0){
			suml[i]++;
		}
		else if(ch[i]==')'&&i==0){
			sumr[i]++;
		}
		else if(ch[i]=='('){
			suml[i]=suml[i-1]+1;
			sumr[i]=sumr[i-1];
		}
		else if(ch[i]==')'){
			sumr[i]=sumr[i-1]+1;
			suml[i]=suml[i-1];
		}
	}
	for(int i=0;i<len-1;i++){
		if(ch[i]==')')
			continue;
		ll mn=min(suml[i],sumr[len-1]-sumr[i]);
//		for(int j=1;j<=mn;j++){
//			ans+=(getans(suml[i]-1,suml[i]-j)%model)*(getans(sumr[len-1]-sumr[i],sumr[len-1]-sumr[i]-j)%model);
//			ans%=model;
//		}
//		ans+=getans(suml[i]+sumr[len-1]-sumr[i]-1,min(suml[i],sumr[len-1]-sumr[i]-1));

		if(temp[suml[i]]==0||temp[sumr[len-1]-sumr[i]-1]==0)
			ans+=1;
		else
//			ans+=temp[suml[i]+sumr[len-1]-sumr[i]-1]/(temp[suml[i]]*temp[sumr[len-1]-sumr[i]-1]);
			ans+=temp[suml[i]+sumr[len-1]-sumr[i]-1]*pow(temp[suml[i]],model-2)*pow(temp[sumr[len-1]-sumr[i]-1],model-2);
//		cout<<temp[suml[i]+sumr[len-1]-sumr[i]-1]<<" "<<temp[suml[i]]<<" "<<temp[sumr[len-1]-sumr[i]-1]<<endl;
		ans%=model;
	}
	cout<<ans<<endl;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const int MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x >>= 1;
	}
	return res;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= n; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]]) * invfact[prefOpen[i]] % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x /= 2ll;
	}
	return res % MOD;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= 2 * n + 100; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			assert(prefOpen[i] - 1 + suffClose[i] <= 2 * n + 100);
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x /= 2ll;
	}
	return res % MOD;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= 2 * n + 100; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(' && suffClose[i] >= 1) {
			assert(prefOpen[i] - 1 + suffClose[i] <= 2 * n + 100);
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x >>= 1ll;
	}
	return res;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= n; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x /= 2ll;
	}
	return res % MOD;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= n + 10; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x /= 2ll;
	}
	return res % MOD;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= 2 * n + 100; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			assert(prefOpen[i] - 1 + suffClose[i] <= 2 * n + 100);
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x >>= 1ll;
	}
	return res;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= n + 10; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x /= 2ll;
	}
	return res % MOD;
}

signed main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<ll> prefOpen(n);
	vector<ll> suffClose(n);
	prefOpen[0] = (s[0] == '(');
	for (int i = 1; i < n; i++) {
		prefOpen[i] = prefOpen[i - 1] + (s[i] == '(');
	}
	suffClose[n - 1] = (s[n - 1] == ')');
	for (int i = n - 2; i >= 0; i--) {
		suffClose[i] = suffClose[i + 1] + (s[i] == ')');
	}
	vector<ll> fact, invfact;
	fact.pb(1);
	for (ll i = 1; i <= 2 * n + 100; i++) {
		fact.pb((fact.back() * i) % MOD);
	}
	for (ll i = 0; i < fact.size(); i++) {
		invfact.pb(pw(fact[i], MOD - 2));
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			ll t = (fact[prefOpen[i] - 1 + suffClose[i]] * invfact[prefOpen[i]]) % MOD;
			t = (t * invfact[suffClose[i] - 1]) % MOD;
			ans = (ans + t) % MOD;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll inv(ll b){return b==1?1:(mod-mod/b)*inv(mod%b)%mod;}//�˷���Ԫ
ll jc[200100];
ll c(ll m,ll n){
	if(m<n)
		return 0;
	return jc[m]*inv(jc[n])%mod*inv(jc[m-n])%mod;
}
int main(){
	jc[0]=1;
	for(int i=1;i<=200000;i++)
		jc[i]=jc[i-1]*i%mod;
	int sr=0,l=0,r;
	ll ans=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
		if(s[i]==')')
			sr++;
	r=sr;
	for(int i=0;i<s.size();i++){
		if(s[i]=='('){
			l++;
			ans=(ans+c(l+r-1,l))%mod;
		}
		else r--;
	}
	printf("%lld\n",ans);
}


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

const int mod=1e9+7;
ll jc[200100];
ll inv(ll b)
{
	return b==1?1:(mod-mod/b)*inv(mod%b)%mod;
}
ll c(ll m,ll n)
{
	if(m<n)
		return 0;
	return jc[m]*inv(jc[n])%mod*inv(jc[m-n])%mod;
}
int main()
{
	jc[0]=1;
	for(int i=1;i<=200000;i++)
		jc[i]=jc[i-1]*i%mod;
	int sr=0,l=0,r;
	ll ans=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
		if(s[i]==')')
			sr++;
	r=sr;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='(')
			l++ , ans=(ans+c(l+r-1,l))%mod;
		else
			r--;
	}
	cout << ans << '\n'
}


// #pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

//typedef tree<
//        pair<int, int>, // change type
//        null_type,
//        less<pair<int, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

#define     pii             pair<int ,int>
#define     ff              first
#define     ss              second
#define     pb(x)           push_back(x )
#define     mp              make_pair
#define     sz(x)           x.size()
#define     clr(x)          x.clear()
#define     mem(x ,y)       memset(x , y , sizeof x )
#define     all(a )         a.begin() , a.end()
#define     endl            "\n"
#define     si(x )          scanf("%d", &x)
#define     sl(x )          scanf("%I64d", &x)
#define     sd(x )          scanf("%lf", &x)
#define     sii(x,y )       scanf("%d%d", &x,&y)
#define     siii(x,y ,z)    scanf("%d%d%d ", &x,&y , &z)
#define     rep(i ,n )      for(int i = 0 ; i < n ; i++ )
#define     repi(i ,n )     for(int i = 1 ; i <= n ; i++ )
#define     forn(i ,x,n )   for(int i = x ; i <= n ; i++ )
#define     repit(i, c)     for( __typeof((c).begin()) i = (c).begin(); i != (c).end();++i )
#define     dbg(args...)    do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;

typedef long long ll  ;
typedef unsigned long long  ull ;
typedef vector<int> vi  ;

const ll  mod =  1e9+7;
const int  inf = 1e9+7  ;
const long long  infL = 1e18 ;

int setbit(int n, int pos  ) { return n = n|(1<< pos) ; }
int resetbit(int n,int pos ) {  return n =  n & ~(1<<pos ); }
bool checkbit(int  n,int pos ) { return (bool ) (n&(1<<pos))  ; }

template < typename T > T mul(T x, T y   ) { x %= mod ; y %= mod ; return (x*y)%mod  ;  }
template < typename T > T add(T x, T y  ) { x %= mod ; y %= mod ; return (x+y)%mod ;  }
template < typename T > T modPow(T x, T k ,T mod ) { if(k == 0 ) return 1; if(k&1  ) { return ( (x%mod)*modPow(x,k-1, mod )%mod )%mod ; } else { T ret = modPow(x,k/2 , mod ) ; ret %= mod ; return (ret*ret )%mod; } }
template < typename T > T ext_gcd(T num1 , T num2, T &X , T &Y ) { T r2,r1, q2, q1 , x2, x1, y2 ,y1 , x,  y, r   ; x2 = 1; y2 = 0;  x1 = 0; y1 = 1; for( r2 =num1 ,r1 = num2 ;r1 != 0 ; y2 = y1, y1 = y,x2 = x1 ,x1 = x ,r2 = r1, r1 = r) {q1 = r2/r1; x = x2 - q1*x1; y = y2 - q1*y1; r = r2%r1 ; } X = x2 ; Y = y2 ; return r2 ;  }
template < typename T > void print(const T& v) {    cerr << v << ' ' ;}
template < typename T1, typename... T2 > void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}
template < typename T > T modInv( T x , T m ) {
    return modPow(x,m-2 , m) ;
    // long long ret, t ;//
    // ext_gcd( x, m ,ret ,t  ) ;
    // ret %= m ; if(ret<0) ret += m  ;
    // return ret;
}
// debuging ...
template<typename T >
void dbg_a(T a[] ,int n=10 ) {
    rep(i,n )cerr<<a[i]<<' ' ;
    cerr<< endl;
}

template < typename F,  typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "[ " << p.first << ", " << p.second << " ]";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[ "; rep(i , sz( v)  )  os << v[i] << ' ' ; return os << " ]" ;
}

//int dx[] = {0 , 0 ,+1, -1 } ;
//int dy[] = {-1, +1,0 , 0 };

int modAdd(int &x , int y) {
    x += y ;
    if(x>= mod ) x-=mod;
    return x ;
}
const int M = (int )2e6+5356;
const int mx = (int)5000+123;
const int nx  = 500+ 2 ;

////  code from here ...
int  a[M+2 ] ,pre[M+2], suf[M+2 ]  ;
int  fact[M+ 2]  ;

// ll ncr (ll x,ll y ) {
//     ll xy= fact[x ] ,t ;

//     ll mx = modInv(x,mod );
//     ll my = modInv(y,mod );

//     t = mul(xy , mul(mx,my) ) ;

//     dbg(xy, t ,mx,my ) ;
//     return t  ;

// }

int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {
    if (!a) {
        x = 0;
        y = 1;
        return b;
    }
    int64_t x1, y1;
    int64_t d = extGcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

inline int addMod(int a, int b, int m = mod) {
    return ((int64_t)a + b) % m;
}

inline int mulMod(int a, int b, int m = mod) {
    return ((int64_t)a * b) % m;
}

inline int divMod(int a, int b, int m = mod) {
    int64_t x, y;
    int64_t g = extGcd(b, m, x, y);
    if (g != 1) {
        cerr << "Bad gcd!" << endl;
        for (;;);
    }
    x = (x % m + m) % m;
    return mulMod(a, x, m);
}

const int factRange = 1000000;

inline void precalcFactorials() {
    fact[0] = 1;
    for (int i = 1; i < factRange; i++) {
        fact[i] = mulMod(fact[i-1], i);
    }
}

inline int F(int n) {
    return (n < 0) ? 0 : fact[n];
}

inline ll ncr( int n , int  k) {
    return divMod(F(n), mulMod(F(n-k), F(k)))*1LL;
}

void solve() {
    ll  q  ,x ,ans ,   type ,r=-1 ,lptr,rptr ;
    string  s;
    cin>> s ;
    s = "d"+s;
    repi(i,sz(s) -1) pre[i]= (s[i]=='('?1:0) ;
    for(int i=sz(s)-1;i>0; i--) suf[i] = (s[i]== ')'?1:0) ;
    repi(i ,sz(s)- 1) pre[i]+=pre[i-1] ;
    for(int i=sz(s)-1;i >0 ;i--) suf[i]+= suf[i+1] ;

    precalcFactorials() ;
    //dbg(ncr(3, 1) ) ;
    ans  = 0;
    repi(i , sz(s)-1) {
        if(s[i]==')')continue ;

        ans = add(ans , ncr(pre[i]+suf[i]-1 ,pre[i]   ) ) ; //

      //  dbg(i ,  pre[i] ,suf[i] ,ans )  ;
    }

    cout << ans ;

}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
     //   freopen("out.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
    int t=1 , c= 0 ; // si( t) ;
    //cin>>t ;
    while(t--) {
       // printf("Case %d: ",++c)  ;
        solve();

    }

}

// no more fuckery .. solve just one hard poroblem a day


// #pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

//typedef tree<
//        pair<int, int>, // change type
//        null_type,
//        less<pair<int, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

#define     pii             pair<int ,int>
#define     ff              first
#define     ss              second
#define     pb(x)           push_back(x )
#define     mp              make_pair
#define     sz(x)           x.size()
#define     clr(x)          x.clear()
#define     mem(x ,y)       memset(x , y , sizeof x )
#define     all(a )         a.begin() , a.end()
#define     endl            "\n"
#define     si(x )          scanf("%d", &x)
#define     sl(x )          scanf("%I64d", &x)
#define     sd(x )          scanf("%lf", &x)
#define     sii(x,y )       scanf("%d%d", &x,&y)
#define     siii(x,y ,z)    scanf("%d%d%d ", &x,&y , &z)
#define     rep(i ,n )      for(int i = 0 ; i < n ; i++ )
#define     repi(i ,n )     for(int i = 1 ; i <= n ; i++ )
#define     forn(i ,x,n )   for(int i = x ; i <= n ; i++ )
#define     repit(i, c)     for( __typeof((c).begin()) i = (c).begin(); i != (c).end();++i )
#define     dbg(args...)    do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;

typedef long long ll  ;
typedef unsigned long long  ull ;
typedef vector<int> vi  ;

const ll  mod =  1e9+7;
const int  inf = 1e9+7  ;
const long long  infL = 1e18 ;

int setbit(int n, int pos  ) { return n = n|(1<< pos) ; }
int resetbit(int n,int pos ) {  return n =  n & ~(1<<pos ); }
bool checkbit(int  n,int pos ) { return (bool ) (n&(1<<pos))  ; }

template < typename T > T mul(T x, T y   ) { x %= mod ; y %= mod ; return (x*y)%mod  ;  }
template < typename T > T add(T x, T y  ) { x %= mod ; y %= mod ; return (x+y)%mod ;  }
template < typename T > T modPow(T x, T k ,T mod ) { if(k == 0 ) return 1; if(k&1  ) { return ( (x%mod)*modPow(x,k-1, mod )%mod )%mod ; } else { T ret = modPow(x,k/2 , mod ) ; ret %= mod ; return (ret*ret )%mod; } }
template < typename T > T ext_gcd(T num1 , T num2, T &X , T &Y ) { T r2,r1, q2, q1 , x2, x1, y2 ,y1 , x,  y, r   ; x2 = 1; y2 = 0;  x1 = 0; y1 = 1; for( r2 =num1 ,r1 = num2 ;r1 != 0 ; y2 = y1, y1 = y,x2 = x1 ,x1 = x ,r2 = r1, r1 = r) {q1 = r2/r1; x = x2 - q1*x1; y = y2 - q1*y1; r = r2%r1 ; } X = x2 ; Y = y2 ; return r2 ;  }
template < typename T > void print(const T& v) {    cerr << v << ' ' ;}
template < typename T1, typename... T2 > void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}

template < typename T > T
modInv( T x , T m ) {
    return modPow(x,m-2 , m) ;
    // long long ret, t ;//
    // ext_gcd( x, m ,ret ,t  ) ;
    // ret %= m ; if(ret<0) ret += m  ;
    // return ret;
}
// debuging ...
template<typename T >
void dbg_a(T a[] ,int n=10 ) {
    rep(i,n )cerr<<a[i]<<' ' ;
    cerr<< endl;
}

template < typename F,  typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "[ " << p.first << ", " << p.second << " ]";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[ "; rep(i , sz( v)  )  os << v[i] << ' ' ; return os << " ]" ;
}

//int dx[] = {0 , 0 ,+1, -1 } ;
//int dy[] = {-1, +1,0 , 0 };

ll modAdd(ll &x ,ll  y) {
    x += y ;
    if(x>= mod ) x-=mod;
    return x ;
}
const int M = (int )2e5+10 ;
const int mx = (int)5000+123;
const int nx  = 500+ 2 ;

////  code from here ...
ll a[M+2 ] ,pre[M+2], suf[M+2 ]  ;
ll  fact[M+ 2]  ,inv[M+2 ] ;
void  func() {
    fact[0]=1;
    repi(i, M) fact[i] = mul(fact[i-1], i*1LL )  ;
    rep(i,M) inv[i ] =  modInv( fact[i] ,mod);

   // dbg_a(fact ) ;
}

ll ncr (ll n ,ll r  ) {
    ll nr = inv[n-r ] ;
    n = fact[n ] ;
    r = inv[r ] ;

    //dbg(n,r ,nr )    ;
 //   dbg(xy, t ,mx,my ) ;
    return mul(n, mul(r,nr) )   ;

}

void solve() {

    ll  q  ,x ,ans ,   type ,r=-1 ,lptr,rptr ;
    string  s;
    cin>> s ;
    s = "d"+s;
    repi(i,sz(s) -1) pre[i]= (s[i]=='('?1:0) ;
    for(int i=sz(s)-1;i>0; i--) suf[i] = (s[i]== ')'?1:0) ;
    repi(i ,sz(s)- 1) pre[i]+=pre[i-1] ;
    for(int i=sz(s)-1;i >0 ;i--) suf[i]+= suf[i+1] ;

    func() ;
    //dbg(ncr(3, 1) ) ;
    ans  = 0;
    repi(i , sz(s)-1) {
        if(s[i]==')')continue ;
        if(suf[i]==0 )  continue;
        ans = modAdd(ans , ncr(pre[i]+suf[i]-1 ,pre[i]   ) ) ; //

      //  dbg(i ,  pre[i] ,suf[i] ,ans )  ;
    }

    cout << ans ;

}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
     //   freopen("out.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
    int t=1 , c= 0 ; // si( t) ;
    //cin>>t ;
    while(t--) {
       // printf("Case %d: ",++c)  ;
        solve();

    }

}

// no more fuckery .. solve just one hard poroblem a day


// #pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

//typedef tree<
//        pair<int, int>, // change type
//        null_type,
//        less<pair<int, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

#define     pii             pair<int ,int>
#define     ff              first
#define     ss              second
#define     pb(x)           push_back(x )
#define     mp              make_pair
#define     sz(x)           x.size()
#define     clr(x)          x.clear()
#define     mem(x ,y)       memset(x , y , sizeof x )
#define     all(a )         a.begin() , a.end()
#define     endl            "\n"
#define     si(x )          scanf("%d", &x)
#define     sl(x )          scanf("%I64d", &x)
#define     sd(x )          scanf("%lf", &x)
#define     sii(x,y )       scanf("%d%d", &x,&y)
#define     siii(x,y ,z)    scanf("%d%d%d ", &x,&y , &z)
#define     rep(i ,n )      for(int i = 0 ; i < n ; i++ )
#define     repi(i ,n )     for(int i = 1 ; i <= n ; i++ )
#define     forn(i ,x,n )   for(int i = x ; i <= n ; i++ )
#define     repit(i, c)     for( __typeof((c).begin()) i = (c).begin(); i != (c).end();++i )
#define     dbg(args...)    do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;

typedef long long ll  ;
typedef unsigned long long  ull ;
typedef vector<int> vi  ;

const int   mod =  1e9+7;
const int  inf = 1e9+7  ;
const long long  infL = 1e18 ;

int setbit(int n, int pos  ) { return n = n|(1<< pos) ; }
int resetbit(int n,int pos ) {  return n =  n & ~(1<<pos ); }
bool checkbit(int  n,int pos ) { return (bool ) (n&(1<<pos))  ; }

template < typename T > T mul(T x, T y   ) { x %= mod ; y %= mod ; return (x*y)%mod  ;  }
template < typename T > T add(T x, T y  ) { x %= mod ; y %= mod ; return (x+y)%mod ;  }
template < typename T > T modPow(T x, T k ,T mod ) { if(k == 0 ) return 1; if(k&1  ) { return ( (x%mod)*modPow(x,k-1, mod )%mod )%mod ; } else { T ret = modPow(x,k/2 , mod ) ; ret %= mod ; return (ret*ret )%mod; } }
template < typename T > T ext_gcd(T num1 , T num2, T &X , T &Y ) { T r2,r1, q2, q1 , x2, x1, y2 ,y1 , x,  y, r   ; x2 = 1; y2 = 0;  x1 = 0; y1 = 1; for( r2 =num1 ,r1 = num2 ;r1 != 0 ; y2 = y1, y1 = y,x2 = x1 ,x1 = x ,r2 = r1, r1 = r) {q1 = r2/r1; x = x2 - q1*x1; y = y2 - q1*y1; r = r2%r1 ; } X = x2 ; Y = y2 ; return r2 ;  }
template < typename T > void print(const T& v) {    cerr << v << ' ' ;}
template < typename T1, typename... T2 > void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}
template < typename T > T modInv( T x , T m ) {
    return modPow(x,m-2 , m) ;
    // long long ret, t ;//
    // ext_gcd( x, m ,ret ,t  ) ;
    // ret %= m ; if(ret<0) ret += m  ;
    // return ret;
}
// debuging ...
template<typename T >
void dbg_a(T a[] ,int n=10 ) {
    rep(i,n )cerr<<a[i]<<' ' ;
    cerr<< endl;
}

template < typename F,  typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "[ " << p.first << ", " << p.second << " ]";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[ "; rep(i , sz( v)  )  os << v[i] << ' ' ; return os << " ]" ;
}

//int dx[] = {0 , 0 ,+1, -1 } ;
//int dy[] = {-1, +1,0 , 0 };

int modAdd(int &x , int y) {
    x += y ;
    if(x>= mod ) x-=mod;
    return x ;
}
const int M = (int )2e6+5356;
const int mx = (int)5000+123;
const int nx  = 500+ 2 ;

////  code from here ...
int  a[M+2 ] ,pre[M+2], suf[M+2 ]  ;
int  fact[M+ 2]  ;

// ll ncr (ll x,ll y ) {
//     ll xy= fact[x ] ,t ;

//     ll mx = modInv(x,mod );
//     ll my = modInv(y,mod );

//     t = mul(xy , mul(mx,my) ) ;

//     dbg(xy, t ,mx,my ) ;
//     return t  ;

// }

int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {
    if (!a) {
        x = 0;
        y = 1;
        return b;
    }
    int64_t x1, y1;
    int64_t d = extGcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

inline int addMod(int a, int b, int m = mod) {
    return ((int64_t)a + b) % m;
}

inline int mulMod(int a, int b, int m = mod) {
    return ((int64_t)a * b) % m;
}

inline int divMod(int a, int b, int m = mod) {
    int64_t x, y;
    int64_t g = extGcd(b, m, x, y);
    if (g != 1) {
        cerr << "Bad gcd!" << endl;
        for (;;);
    }
    x = (x % m + m) % m;
    return mulMod(a, x, m);
}

const int factRange = 1000000;

inline void precalcFactorials() {
    fact[0] = 1;
    for (int i = 1; i < factRange; i++) {
        fact[i] = mulMod(fact[i-1], i);
    }
}

inline int F(int n) {
    return (n < 0) ? 0 : fact[n];
}

inline ll ncr( int n , int  k) {
    return divMod(F(n), mulMod(F(n-k), F(k)))*1LL;
}

void solve() {
    int  q  ,x ,ans ,   type ,r=-1 ,lptr,rptr ;
    string  s;
    cin>> s ;
    s = "d"+s;
    repi(i,sz(s) -1) pre[i]= (s[i]=='('?1:0) ;
    for(int i=sz(s)-1;i>0; i--) suf[i] = (s[i]== ')'?1:0) ;
    repi(i ,sz(s)- 1) pre[i]+=pre[i-1] ;
    for(int i=sz(s)-1;i >0 ;i--) suf[i]+= suf[i+1] ;

    precalcFactorials() ;
    //dbg(ncr(3, 1) ) ;
    ans  = 0;
    repi(i , sz(s)-1) {
        if(s[i]==')')continue ;

        ans = addMod(ans , ncr(pre[i]+suf[i]-1 ,pre[i]   )  ,mod ) ; //

      //  dbg(i ,  pre[i] ,suf[i] ,ans )  ;
    }

    cout << ans ;

}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
     //   freopen("out.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
    int t=1 , c= 0 ; // si( t) ;
    //cin>>t ;
    while(t--) {
       // printf("Case %d: ",++c)  ;
        solve();

    }

}

// no more fuckery .. solve just one hard poroblem a day


//HovalHaq!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Mx = 2 << 17, M = 1000 * 1000 * 1000 + 7;
int F[Mx], G[Mx];

int re(int a, int b = M - 2) {
	if(b == 0) return 1;
	ll c = re(a, b / 2);
	c = (c * c) % M;
	if(b & 1) c = (c * a) % M;
	return c;
}

int C(int a, int b) {
	return (F[b] * (ll(G[a]) * G[b - a]) % M) % M;
}

int main() {
	F[0] = G[0] = 1;
	for(int i = 1; i < Mx; i++) G[i] = re(F[i] = (F[i - 1] * i) % M);
	string S; cin >> S;
	int oc = 0, cc = 0;
	for(char c : S)
		if(c == ')')
			cc++;
	int a = 0;
	for(int i = 0; i < S.size(); i++) {
		if(S[i] == ')') {
			cc--;
			continue;
		}
		a += C(oc + 1, oc + cc);
		oc++;
	}
	cout << a;
}


//HovalHaq!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int Mx = 2 << 17, M = 1000 * 1000 * 1000 + 7;
int F[Mx], G[Mx];

int re(int a, int b = M - 2) {
	if(b == 0) return 1;
	ll c = re(a, b / 2);
	c = (c * c) % M;
	if(b & 1) c = (c * a) % M;
	return c;
}

int C(int a, int b) {
	return F[b] * ((ll(G[a]) * G[b - a]) % M) % M;
}

int32_t main() {
	F[0] = G[0] = 1;
	for(ll i = 1; i < Mx; i++) G[i] = re(F[i] = ((F[i - 1] * i) % M));
	string S; cin >> S;
	int oc = 0, cc = 0;
	for(char c : S)
		if(c == ')')
			cc++;
	int a = 0;
	for(int i = 0; i < S.size(); i++) {
		if(S[i] == ')') {
			cc--;
			continue;
		}
		a = (a + C(oc + 1, oc + cc)) % M;
		oc++;
	}
	cout << a;
}


//HovalHaq!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int Mx = 2 << 17, M = 1000 * 1000 * 1000 + 7;
int F[Mx], G[Mx];

int re(int a, int b = M - 2) {
	if(b == 0) return 1;
	ll c = re(a, b / 2);
	c = (c * c) % M;
	if(b & 1) c = (c * a) % M;
	return c;
}

int C(int a, int b) {
	return (F[b] * (ll(G[a]) * G[b - a]) % M) % M;
}

int32_t main() {
	F[0] = G[0] = 1;
	for(ll i = 1; i < Mx; i++) G[i] = re(F[i] = ((F[i - 1] * i) % M));
	string S; cin >> S;
	int oc = 0, cc = 0;
	for(char c : S)
		if(c == ')')
			cc++;
	int a = 0;
	for(int i = 0; i < S.size(); i++) {
		if(S[i] == ')') {
			cc--;
			continue;
		}
		a = (a + C(oc + 1, oc + cc)) % M;
		oc++;
	}
	cout << a;
}


#include <bits/stdc++.h>

const int N = 200100;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;

long long Pow(long long a, long long b) {
  long long ans = 1ll;
  for (long long tmp = a; b;) {
    if (b & 1) {
      ans = (ans * tmp) % mod;
    }
    tmp = (tmp * tmp) % mod;
    b >>= 1ll;
  }
  return ans;
}

class NumberPreprocess {

public:
  NumberPreprocess() {}

  // 预处理[1,n]阶乘及其逆
  // 时间复杂度O(nlogn)
  void FactorialWithInv(int n) {
    fac[0] = 1ll;
    fac_inv[0] = Pow(fac[0], mod - 2ll);
    for (int i = 1; i <= n; ++i) {
      fac[i] = fac[i - 1] * (long long)i % mod;
      fac_inv[i] = Pow(fac[i], mod - 2ll);
    }
  }

  // 输出组合数C(a,b)
  // 需要预处理阶乘及其逆
  // 时间复杂度O(1)
  long long C(int a, int b) {
    if (b < 0 || a < 0 || b > a) {
      return 0ll;
    }
    return ((fac[a] * fac_inv[b]) % mod * fac_inv[a - b]) % mod;
  }

  // 预处理[1,n]逆元
  // 时间复杂度O(n)
  void InverseElement(int n) {
    inv[1] = 1ll;
    for(int i = 2; i <= n; ++i) {
      inv[i] = (mod - mod / i) * inv[mod % i] % mod;
    }
  }

  // 输出i的逆
  // 需要先执行InverseElement(n)
  // 时间复杂度O(1)
  long long Inv(int i) {
    return inv[i];
  }

private:
  // 阶乘
  long long fac[N];       // fac[i]= i!
  long long fac_inv[N];   // fac_inv[i] = i!的逆元
  long long inv[N];       // inv[i]: i的逆元
}np; // class NumberPreprocess

int t;
long long n;
int k;
int a[N];
int b[N];
long long ans1, ans2;
char s[N];
int pre[N];
int suf[N];
long long ans;

int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  np.FactorialWithInv(len);
  for (int i = 1; i <= len; ++i) {
    pre[i] = pre[i - 1] + (s[i] == '(' ? 1: 0);
  }
  for (int i = len; i >= 1; --i) {
    suf[i] = suf[i + 1] + (s[i] == ')' ? 1 : 0);
  }
  for (int i = 1; i <= len; ++i) {
    if (s[i] == '(') {
      ans = (ans + np.C(pre[i] - 1 + suf[i], pre[i])) % mod;
    }
  }
  printf("%lld\n", ans);
  return 0;
}


#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>
#include<unordered_map>
//#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   vec(g1)   int temp;cin>>temp;g1,push_back(temp);
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   MIN     INT_MIN
#define   yeet    return 0;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 + 7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}

inline int addMod(int a, int b, int m = mod) {return ((int64_t)a + b) % m;}
inline int mulMod(int a, int b, int m = mod) {	return ((int64_t)a * b) % m;}
inline int divMod(int a, int b, int m = mod) {int64_t x, y;int64_t g = extGcd(b, m, x, y);if (g != 1) {cerr << "Bad gcd!" << endl;for (;;);}x = (x % m + m) % m;return mulMod(a, x, m);}
const int factRange = 1000000;
int fact[factRange];
inline void precalcFactorials() {fact[0] = 1;for (int i = 1; i < factRange; i++) {fact[i] = mulMod(fact[i-1], i);}}
inline int F(int n) {return (n < 0) ? 0 : fact[n];}
inline int C(int k, int n) {return divMod(F(n), mulMod(F(n-k), F(k)));}
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
int modInverse(int A,int M){return powmod(A,M-2);}
//const int N= 10000000;int lp[N+1];vector<int> pr;void seive(){for (int i=2; i<=N; ++i) {if (lp[i] == 0) {lp[i] = i;pr.push_back (i);}for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) lp[i * pr[j]] = pr[j]; }}
////****************************************************************************************************************************************************************************************************************////
 int main(){
 	string s;
 	cin>>s;
 	precalcFactorials();
 	int n=s.size();
 	pair<int,int>  a[n];
 	f(i,0,n){
 		 if(s[i]==')'){a[i].fi=1;a[i].se=0;}
 		 else {a[i].se=1;a[i].fi=0;}
 	}
 	pair<int,int> b[n];
 	b[0].se=a[0].se;
 	b[n-1].fi=a[n-1].fi;
 	f(i,1,n){
       b[i].se=b[i-1].se+a[i].se;
 	}
 	for(int i=n-2;i>=0;i--){
 		 b[i].fi=b[i+1].fi+ a[i].fi;
 	}
 	ll ans=0;
 	//for(int i=0;i<n;i++)cout<<b[i].fi<<" "<<b[i].se<<endl;
 	 for(int i=0;i<n;i++){
 	 	 if(s[i]!='(' || b[i].fi==0)continue;
 	 	 int add= C(b[i].se,b[i].se+b[i].fi -1);
 	 	 ans=addMod(ans,add);
 	 }
    cout<<ans<<endl;
  	yeet
 }


#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>
#include<unordered_map>
//#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   vec(g1)   int temp;cin>>temp;g1,push_back(temp);
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   MIN     INT_MIN
#define   yeet    return 0;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +9 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}

inline int addMod(int a, int b, int m = mod) {return ((int64_t)a + b) % m;}
inline int mulMod(int a, int b, int m = mod) {  return ((int64_t)a * b) % m;}
inline int divMod(int a, int b, int m = mod) {int64_t x, y;int64_t g = extGcd(b, m, x, y);if (g != 1) {cerr << "Bad gcd!" << endl;for (;;);}x = (x % m + m) % m;return mulMod(a, x, m);}
const int factRange = 1000000;
int fact[factRange];
inline void precalcFactorials() {fact[0] = 1;for (int i = 1; i < factRange; i++) {fact[i] = mulMod(fact[i-1], i);}}
inline int F(int n) {return (n < 0) ? 0 : fact[n];}
inline int C(int k, int n) {return divMod(F(n), mulMod(F(n-k), F(k)));}
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
//const int N= 10000000;int lp[N+1];vector<int> pr;void seive(){for (int i=2; i<=N; ++i) {if (lp[i] == 0) {lp[i] = i;pr.push_back (i);}for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) lp[i * pr[j]] = pr[j]; }}
////****************************************************************************************************************************************************************************************************************////
 int main(){
   int n,k;
   cin>>n>>k;
   string s;
   cin>>s;
   int del = n-k;
   if(del<=0){cout<<s;yeet}
   stack<char>s1;
   s1.push(s[0]);
   int cnt=0;
   int se=-1;
   for(int i=1;i<n;i++){
       if(!s1.empty() and s1.top()=='(' and s[i]==')'){
         s1.pop();
         cnt++;
       }
       else s1.push(s[i]);
       if(2*cnt  == del){se=i+1;break;}
   }
   while(!s1.empty()){cout<<s1.top();s1.pop();}
   for(int i=se;i<n;i++)cout<<s[i];

  return 0;
 }


#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>
#include<unordered_map>
//#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   vec(g1)   int temp;cin>>temp;g1,push_back(temp);
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   MIN     INT_MIN
#define   yeet    return 0;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 + 7 ;
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
int modInverse(int A,int M){return powmod(A,M-2);}

 // ll fac[200005];
// ll inverse(ll n){return powmod(n, mod-2);}
// ll nCr(ll n, ll r){return (fac[n] * inverse(fac[r]) % mod * inverse(fac[n-r]) % mod) % mod;}
//const int N= 10000000;int lp[N+1];vector<int> pr;void seive(){for (int i=2; i<=N; ++i) {if (lp[i] == 0) {lp[i] = i;pr.push_back (i);}for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) lp[i * pr[j]] = pr[j]; }}
////****************************************************************************************************************************************************************************************************************////
 int main(){
 	string s;
 	cin>>s;
 	int n=s.size();
 	pair<int,int>  a[n];
 	f(i,0,n){
 		 if(s[i]==')'){a[i].fi=1;a[i].se=0;}
 		 else {a[i].se=1;a[i].fi=0;}
 	}
 	pair<int,int> b[n];
 	b[0].se=a[0].se;
 	b[n-1].fi=a[n-1].fi;
 	f(i,1,n){
       b[i].se=b[i-1].se+a[i].se;
 	}
 	for(int i=n-2;i>=0;i--){
 		 b[i].fi=b[i+1].fi+ a[i].fi;
 	}
 	//for(int i=0;i<n;i++)cout<<b[i].fi<<" "<<b[i].se<<endl;
 	ll ans=0;
 	for(int i=0;i<n;i++){
 		 if(s[i]=='('){
 		 	 ans= (ans%mod + b[i].fi%mod)%mod;
 		 	 if(b[i].fi==b[i].se)ans=(ans%mod + 1%mod)%mod;
 		 }
 	}
 	cout<<ans<<endl;
  	yeet
 }


#include<bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forab(i, a, b) for (int i = (a); i <= (b); i++)
#define forba(i, b, a) for (int i = (b); i >= (a); i--)
#define mset(a, n) memset(a, n, sizeof(a))
#define endl '\n'
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;

const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;

ll f[maxn];
ll invf[maxn];
char s[maxn];
int n;

ll fpow(ll x, ll power)
{
    ll res = 1;
    for (; power; power >>= 1, x = x * x % mod)
        if (power & 1) res = res * x % mod;
    return res;
}

inline ll C(ll n, ll m)//n xuan m
{
    return f[n] * invf[n - m] % mod * invf[m] % mod;
}

inline ll cal(ll l, ll r)
{
    return C(l + r, min(l, r)) - 1;
}

int main()
{
    scanf("%s", s);
    n = (int) strlen(s);
    while(s[n - 1] == '(') n--;
    f[0] = f[1] = 1;
    forab(i, 2, n)
        f[i] = f[i - 1] * i % mod;
    invf[n] = fpow(f[n], mod - 2);
    forba(i, n - 1, 0)
        invf[i] = invf[i + 1] * (i + 1) % mod;
    int l = 0;
    while(l < n && s[l] == ')') l++;

    if(l == n) {
        cout << 0 << endl;
        return 0;
    }
    int r = l;
    while(r < n && s[r] == '(') r++;
    ll ans = 0;
    int l1 = r - l;
    l = r;
    while(l < n && s[l] == ')') l++;
    #ifdef cai
    printf("l = %lld, r = %lld\n", l, r);
    #endif
    int r1 = l - r;
    ans = cal(l1, r1);
    #ifdef cai
    printf("l1 = %d, r1 = %d\n", l1, r1);
    #endif
    while(l < n)
    {
        r = l;
        while(r < n && s[r] == '(') r++;
        int l2 = r - l;
        l = r;
        while(l < n && s[l] == ')') l++;
        int r2 = l - r;
        ans += cal(l1, r1 + r2) + cal(l1 + l2, r2) - cal(l1, r2) - cal(l1, r1);
        #ifdef cai
        printf("l = %lld, r = %lld\n", l, r);
        #endif
        ans %= mod;
        l1 += l2;
        r1 = r2;
        #ifdef cai
        printf("l1 = %d, r1 = %d\n", l1, r1);
        #endif

    }
    cout << (ans + mod) % mod << endl;
}