Spreadsheet#1074

Spreadsheet

1 second
64 megabytes
Very easy

Write a program that simulates a very simple spreadsheet application. The spreadsheet contains rows, numbered from to , and columns, labeled from to . Each cell is named by its column and row, for example, , .

Each cell contains an expression of up to characters. Expressions may use integer constants, references to other cells, parentheses, and binary operators , , , and (integer division). For example, , , (3+B3)*(C4-1) are valid expressions. All operators perform integer arithmetic. Division by zero results in .

If a cell referenced by an expression is not defined, its value is considered to be zero. If two or more cells depend on each other directly or indirectly, this is called a circular reference.

All arguments and results are less than .

Input

The first line contains the number of expressions . Each of the next lines is in the format cellname=expression. All expressions are correct, and each cell is defined by at most one expression.

Output

Output a single line containing either the value of cell , or if the value of cannot be computed because of a circular reference.

Examples

Example 1

Loading
Loading