This page is still under construction.

Parts of this page are still being built. What you see may change.

Omar's addition and subtraction check

Time limit1sMemory limit256 MB

Summary
Check up to 100 equations of the form X + Y = Z or X - Y = Z and print YES or NO for each case.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Ahmed Aly was the chief judge of the last Arab Collegiate Programming Contest, and he is the chief judge of the next one too. He reached the ACM ICPC World Finals in Orlando in 2011, and he now works as a software engineer at Google.

The last contest was the first one the chief judge did not attend in person. His son Omar was due a few days before or after the contest, so he could not travel to Jordan. Omar was born 10 days after the contest ended.

Omar is 9 months old now, old enough to start learning programming. His first program is a very simple one that adds or subtracts two numbers. Decide whether each equation the program produced is correct.

Input

The first line contains the number of test cases TT (1≤T≤1001 \le T \le 100).

Each of the next TT lines contains one equation in the format X O Y = Z. XX, YY and ZZ are positive integers with 1≤X,Y,Z≤1001 \le X, Y, Z \le 100, and OO is either + or -. Every token is separated by a single space.

Output

For each test case print one line. Print Case n:, where nn is the test case number starting from 1, then a single space, then YES if the equation is correct and NO if it is wrong.

Examples5

  1. Example 1

    Input
    4
    1 + 23 = 22
    1 + 22 = 23
    22 - 1 = 23
    23 - 1 = 22
    
    Expected output
    Case 1: NO
    Case 2: YES
    Case 3: NO
    Case 4: YES
    
  2. Example 2

    Input
    1
    1 + 1 = 2
    
    Expected output
    Case 1: YES
    
  3. Example 3

    Input
    1
    1 - 1 = 1
    
    Expected output
    Case 1: NO
    
  4. Example 4

    Input
    4
    50 + 50 = 100
    100 - 1 = 99
    100 + 100 = 100
    100 - 100 = 100
    
    Expected output
    Case 1: YES
    Case 2: YES
    Case 3: NO
    Case 4: NO
    
  5. Example 5

    Input
    3
    1 - 100 = 99
    1 - 2 = 1
    2 - 1 = 1
    
    Expected output
    Case 1: NO
    Case 2: NO
    Case 3: YES