Given a binary tree, find the sum of values at all leaf nodes.
Defintion of leaf nodes: nodes without any child nodes.
e.g.
1
/ \
2 3
/ \ / \
4 5 6 7
\
8
The answer is 4 + 8 + 6 + 7 = 25
The input has three lines.
The first line contains an integer N indicating the number of nodes of the binary tree.
The second line is the inorder traversal of the binary tree.
The third line is the preorder traversal of the binary tree.
Note that there are no duplicated integers in the binary tree.
Print the sum of values at all leaf nodes.
There are '\n' in the end of input