#P1310. Filling in the Expression to Evaluate Zero

    ID: 14597 Type: Default 1000ms 256MiB

Filling in the Expression to Evaluate Zero

Filling in the Expression to Evaluate Zero

You are given an incomplete expression with three blanks: +(*_). Two operations are defined on one-bit binary variables as follows:

$$\begin{array}{|c|c|} \hline \qquad\qquad\quad\textsf{Operator} & \qquad\qquad\quad\textsf{Operation} \\ \hline \oplus & \begin{aligned}0 \oplus 0 &= 0 \\ 0 \oplus 1 &= 1 \\ 1 \oplus 0 &= 1 \\ 1 \oplus 1 &= 1 \end{aligned} \\ \hline \times & \begin{aligned}0 \times 0 &= 0 \\ 0 \times 1 &= 0 \\ 1 \times 0 &= 0 \\ 1 \times 1 &= 1 \end{aligned} \\ \hline \end{array} $$

The rules for evaluating expressions are:

  1. Compute the operations inside parentheses first.
  2. The multiplication ((\times)) operation is performed before the addition ((\oplus)) operation. For example, in the expression (A \oplus B \times C), the multiplication (B \times C) is computed first, and its result is then combined with (A) using the addition ((\oplus)) operation.

In the expression +(_), fill in each blank with either (0) or (1) so that the entire expression evaluates to (0). Note that here the symbol '+' stands in for (\oplus) and '' stands in for (\times).

Determine the number of ways to fill in the blanks.

inputFormat

There is no input for this problem. The expression is fixed as +(*_). Your program should output a single integer representing the number of valid fillings.

outputFormat

Output a single integer: the number of ways to fill the blanks with (0) or (1) such that the expression evaluates to (0).

sample

dummy
3