Define a full binary tree as a binary tree where all nodes, except the leaves, in the tree have children (the leaves have ). All nodes in levels except the bottom must have children. The height is defined as the number of nodes in the path from the root to a leaf, including the root.
You are given a full binary tree with a height of (). Can you count the number of subtrees in the graph? Unlike the usual definition of subtree, a subtree is defined as being a subset of nodes (at least ) and edges of the original tree that forms another valid tree.
Subtask 1 (5%)
Subtask 2 (25%)
Subtask 3 (70%)
No further constraints.
A single integer, , the height of the full binary tree.
A single integer, the number of subtrees.
Since this number can be very large, output your number modulo .
Explanation for Sample
The sample asks for the number of subtrees in a full binary tree of height 2. The valid subtrees are as follows (where the original full binary tree is the rightmost):