#arc172b. B - AtCoder Language
B - AtCoder Language
问题陈述
ATCoder语言具有 个不同的字符。
有多少个由ATCoder语言中的字符组成的 字符串 满足以下条件?求以 为模的计数。
- 字符串 的所有 字符子序列都不同。
更确切地说,有 种方法可以获得 个字符的字符串,方法是从字符串 中提取 个字符并将它们连接起来而不进行更改所有这些方法都必须生成不同的字符串。什么是 ? 是指从 项中选择 的方式的总数。
更准确地说, 是 除以 的值。
以上为机器翻译结果,仅供参考。
Problem Statement
The AtCoder language has different characters. How many -character strings consisting of characters in the AtCoder language satisfy the following condition? Find the count modulo .
- All -character subsequences of the string are different. More precisely, there are ways to obtain a -character string by extracting characters from the string and concatenating them without changing the order, and all of these ways must generate different strings.
What is ? refers to the total number of ways to choose from items. More precisely, is the value of divided by .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the count modulo .
Sample Input 1
4 3 2
Sample Output 1
2
If a
and b
represent the first and second characters in the language, the condition is satisfied by two strings: abab
and baba
.
Sample Input 2
100 80 26
Sample Output 2
496798269
Approximately strings satisfy the condition, but here we print the count modulo , which is .
Sample Input 3
100 1 26
Sample Output 3
0
Sample Input 4
500000 172172 503746693
Sample Output 4
869120
What is ? refers to the total number of ways to choose from items. More precisely, is the value of divided by .