We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- All Contests
- ProjectEuler+
- Project Euler #181: Investigating in how many ways objects of two different colours can be grouped.

# Project Euler #181: Investigating in how many ways objects of two different colours can be grouped.

# Project Euler #181: Investigating in how many ways objects of two different colours can be grouped.

Contest ends in

_{This problem is a programming version of Problem 181 from projecteuler.net}

Having three black objects and one white object they can be grouped in ways like this: .

In how many ways can black objects and white objects be thus grouped?

Print the answer after taking modulo by .

**Input Format**

The first line of each testcase contains an integer . Each of following lines contain two integers and which is the number of black and white objects respectively.

**Constraints**

**Output Format**

Print exactly lines, each containing a single integer which is the answer to the corresponding test modulo .

**Sample Input 0**

```
1
3 1
```

**Sample Output 0**

```
7
```