Counting Cases
Time limit1sMemory limit1024 MB
Given N rabbits that each pick a value from the set X, count the assignments whose product equals k for every k from 1 to K, modulo 1e9+7.
- Level
Hard8 of 10
- Topics
- Number theory, Dynamic programming, Combinatorics, Math
- Solved
- No attempts yet
Problem
The rabbit kingdom has rabbits, numbered from to . Rabbits like integers. The integer that rabbit likes most is . Rabbits do not reveal their favorite integers. Two different rabbits may have the same favorite integer.
A bear that infiltrated the rabbit kingdom found out that rabbits like only the integers in the set . For every , the favorite integer of rabbit is one of the integers in .
The potential of the rabbit kingdom is . For each integer with , the bear wants to count the cases in which the potential of the rabbit kingdom is . Two cases are different if the favorite integer of some rabbit is different.
Let be the number of cases in which the potential of the rabbit kingdom is . Find .
Input
The first line contains , , and , separated by spaces.
The second line contains , separated by spaces.
All numbers in the input are integers.
Output
On the first line, print , separated by spaces.