A binary tree of invoice line amounts is given in level-order form (a single line of space-separated tokens, null marking a missing child; every non-null node contributes exactly two following tokens for its children).
A left leaf is a node that (a) has no children of its own, and (b) is the left child of its parent (a root with no parent is never a left leaf).
Print the sum of the values of every left leaf in the tree.
Input format
Line 1: space-separated level-order tokens describing the binary tree (integers and the token null).
Output format
A single integer: the sum of all left-leaf values. If there are none (including an empty tree), print 0.
Constraints
- 0 <= number of nodes <= 500
- Each node value is an integer with -1000 <= value <= 1000