Firefighters

Time limit1sMemory limit128 MB

Problem

A mathematician kept all of his documents in a file cabinet next to his desk. One day a fire broke out in his office and most of his work was badly damaged. Luckily, some of the equations he had solved during his long career were partially preserved. Each equation had an expression on the left side and a result on the right. The preserved expressions still contained all of their numbers and brackets, but some of the operators between them were lost in the fire. To make things worse, the results of the equations were scattered, so the mathematician is no longer sure whether a given result belongs to a given expression. Your task is to help him decide whether each saved expression and result can match.

You are given an expression that contains integers between 1 and 999, the binary operators +, -, *, /, brackets, and question marks ? that stand for the lost operators. For each expression you must decide whether the lost operators can be filled in so that the expression evaluates to the required result.

The expressions obey the following restrictions:

  1. An expression contains at most 100 characters.
  2. A pair of brackets encloses at most one operator together with its two operands. Each of those operands may itself be a bracketed expression.
  3. Constants are unsigned; there are no negative numbers written in the expressions.
  4. An expression contains at most 10 question marks (lost operators).

Evaluate expressions with these rules:

  1. * and / have higher priority than + and -. Brackets override priority as usual.
  2. All four operators are left associative, i.e. they group from left to right. For numbers a, b, c: a*b*c = (a*b)*c, a/b/c = (a/b)/c, a/b*c = (a/b)*c, a+b+c = (a+b)+c, a-b+c = (a-b)+c.
  3. Division between integers discards the fractional part (truncation toward zero); for example 2/5 = 0, 9/5 = 1, 100/6 = 16.

Input

The first line contains an integer N, the number of equations. Each of the following equations is given on two lines: the first line is the expression (the left side), and the second line is an integer result (the right side). Input lines contain no spaces, and every expression is guaranteed to be free of syntax errors.

Output

For each equation, print yes if the lost operators can be chosen so that the expression equals the result, and no otherwise. Print one answer per line, in the order the equations are given.