Problem Description

Read a list of tokens ending with END. Start sum=0. Add each token as integer. If a token is not integer (and not END), output BAD and stop. If all good, output sum.

Input Format

One line tokens ending with END.

Output Format

BAD token or sum.

Sample Test Case

Input:
10 20 x 5 END
Output:
BAD x

Constraints

Up to 200000 tokens.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next