Stickers
View as PDF
Submit solution
Points:
100
Time limit:
1.0s
PyPy 3
3.0s
Python 3
3.0s
Memory limit:
500M
Problem type
You have identical stickers to hand out to
distinct people. Each person may receive any
number of stickers, including zero. Stickers are indistinguishable, so two distributions that give
every person the same count are the same.
Count the number of ways to give out all stickers. Since the answer can be large, output it
modulo
.
Input
A single line containing two integers and
.
Output
Print one integer: the number of ways to distribute the stickers, modulo .
Constraints
Example 1
Input
3 2
Output
4
Explanation
The four distributions are
,
,
, and
.
Example 2
Input
0 3
Output
1
Explanation
There are no stickers, so everyone gets zero. That is one valid distribution.
Example 3
Input
2 3
Output
6
Explanation
The non-negative integer solutions of are
,
,
,
,
, and
.
Comments