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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. 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.

Problem
Submissions
Leaderboard
Discussions

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

Author

bayleef

Difficulty

Easy

Max Score

100

Submitted By

444

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature