9024 - The Sum of a Tree Path   

Description

Given a binary tree, in which each node has an integer, determine whether there exists a tree path whose sum equal to the queried number. A tree path is a path from the root to a leaf node. The sum of a tree path is the summation of numbers in each node on a tree path. For example, in the tree shown below there are exactly three root-to-leaf paths. The sums of each path are 19, 8 and -6.

The binary tree above is represented by the expression (5(3(11()())(0()()))(1()(-12()()))). With this form, every tree node has an expression (integer()()). The range of the integer in the expression is between -100000 and 100000. And the length of the whole tree expression is at most 100 characters.

Input

The input consists of a sequence of test cases. Each test case occupies a newline. First, there is an integer indicating the query. Second, there is a space. Next, there is a binary tree representation and there are no spaces in the representation.

Output

For each test case, output “yes” or “no” in a new line to check whether the target does exist or not.

Sample Input  Download

Sample Output  Download

Tags




Discuss