You are a modern artist looking to create modern art in modern ways.
You will paint on a canvas tiles long. Each tile can take on two colours: white or red. Initially, all tiles are white.
The paintbrush you'll be using is modern as well. Painting a white tile will turn it red, and painting a red tile will turn it white. Since it's the modern trend, you are only willing to make strokes that paint exactly consecutive tiles. You can make as many strokes as you'd like.
Even the value of modern art is determined in modern ways. The -th tile from the left has a value of , and the value of a painting is the sum of the values of all the red tiles. Being a curious artist, you wonder: of all the final paintings you can create, how many have a value of ? Since this number may be huge, please output it modulo .
Constraints
Subtask 1 [5%]
Subtask 2 [95%]
No additional constraints.
Input Specification
The first line will contain three integers, , , and .
The next line will contain space-separated integers, the -th of which represents .
Output Specification
Output the number of paintings you can create with value equal to , modulo .
Sample Input
3 2 9
3 9 6
Sample Output
1
Comments