#K67402. Even Magic Game

    ID: 32634 Type: Default 1000ms 256MiB

Even Magic Game

Even Magic Game

You are given a game called Even Magic where each test case consists of a sequence of non-negative integers separated by spaces. For each test case, you must sum all the even digits that appear in the numbers. Let \( S \) be the sum of these even digits. Your task is to determine whether \( S \) is a prime number. If \( S \) is prime, output Even Magic!; otherwise, output No Magic!.

Note: The prime check considers numbers less than 2 as non-prime. Digits are processed individually, so for a number like 124, only the even digits 2 and 4 are added.

This problem will test your ability to manipulate strings, perform digit extraction, and implement basic prime checking.

inputFormat

The first line contains an integer T denoting the number of test cases. Each of the following T lines contains a space-separated sequence of non-negative integers representing a test case.

outputFormat

For each test case, output a single line. Print Even Magic! if the sum of the even digits is a prime number; otherwise, print No Magic!.

## sample
3
124 5680 77
2
222 888 444
No Magic!

Even Magic! No Magic!

</p>