Robot - MarisaOJ: Marisa Online Judge

Robot

Time limit: 1500 ms
Memory limit: 256 MB
You have a robot located at point $(0, 0)$ on a 2D plane. The robot can run $n$ command. If the robot are now at $(x, y)$, and you execute the $i^{th}$ command, your robot will move to $(x + x_i, y + y_i)$. Each command can only be executed only once. Count the number of way to reach point $(a, b)$. ### Input - The first line contains an integer $n$. - The second line contains 2 integers $a, b$. - The next $n$ lines, each line contains 2 integers $x_i, y_i$. ### Output - Print the number of ways to reach point $(a, b)$. ### Constraints - $1 \le n \le 40$. - $-10^9 \le x_i, y_i, a, b \le 10^9$. ### Example Input: ``` 2 1 1 0 1 1 0 ``` Output: ``` 1 ```