Formulaic expressions
You have a table with N rows and M columns. The rows are numbered from 1 to N, and the columns are labeled with the letters A through Z.
Each cell in the table is identified by a combination of a column letter and a row number (for example, A2 refers to the cell in column A and row 2).
You need to evaluate an expression that consists of mathematical operations + and/or – applied to these cells. Your task is to write a program that calculates the result of this expression. The expressions are guaranteed to be correctly formatted and contain no spaces.
Input
The first line contains the integers N and M.
The next N lines each contain M numbers, representing the table's contents.
The final line contains the expression to be evaluated.
Output
The result of the evaluated expression.