Problem Description

You get m instructions. Each instruction is: INC x, DEC x, JNZ x off. x is variable name (single word). Start all vars at 0. Execute from line 1. JNZ jumps relative if x!=0. Stop when pointer goes out. Print final value of variable a.

Input Format

First line m. Next m lines instructions.

Output Format

One integer value of a.

Sample Test Case

Input:
5 INC a INC a DEC a JNZ a -2 INC a
Output:
1

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next