Problem Description

You will receive q commands: ADD x, SUB x, MUL x. Start value=0. If any command has invalid number or unknown op, output ERROR at line i (1-based) and stop. Else output final value.

Input Format

First line q. Next q lines commands.

Output Format

Final value or error message.

Sample Test Case

Input:
4 ADD 5 MUL 2 SUB x ADD 1
Output:
ERROR at line 3

Constraints

q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next