#P1999. Counting Faces in a Hypercube
Counting Faces in a Hypercube
Counting Faces in a Hypercube
In an -dimensional hypercube, the number of -dimensional faces is given by the formula [ F(a, b) = \binom{a}{b} \cdot 2^{a-b}, ] where (\binom{a}{b}) is the binomial coefficient. For example, a square (2-dimensional hypercube) has 4 vertices (0-dimensional faces), 4 edges (1-dimensional faces), and 1 square (2-dimensional face); a cube (3-dimensional hypercube) has 8 vertices, 12 edges, 6 faces, and 1 cube.
Given two integers and (with ), compute the number of -dimensional faces contained in an -dimensional hypercube, modulo .
inputFormat
The input consists of a single line containing two space-separated integers and .
outputFormat
Output a single integer representing the number of -dimensional faces in an -dimensional hypercube modulo .
sample
3 1
12