## A Counting Problem 3

View as PDF

Points: 12 (partial)
Time limit: 1.0s
Memory limit: 128M

Problem types

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.

#### Subtasks

##### Subtask 1 (5%) ##### Subtask 2 (25%) ##### Subtask 3 (70%)

No further constraints.

#### Input Specification

A single integer, , the height of the full binary tree.

#### Output Specification

A single integer, the number of subtrees.

Since this number can be very large, output your number modulo .

#### Sample Input

2

#### Sample Output

6

#### 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): ## Comments

There are no comments at the moment.