Counting problems often reduce to exponentiation. If each position has choices and positions are independent, total count is .
When is large (), use modular exponentiation. Direct computation will overflow or time out.
Ceiling and floor tricks for splitting positions: even positions = , odd positions = (integer division).