The Great Game
The great game between Sherlock and Moriarty has started. Moriarty planted many bombs around the city. Now he told Sherlock that it will detonate if he doesn’t solve the code correctly. But Sherlock is in no condition to solve. So Molly comes to the rescue.
Molly has a hunch about the code of the bomb. It has two status - Even or Odd. The bomb will only defuse if you push the button when the status of the summation of the digits are same as the number of digits of the number. Otherwise - “BOOM”.
Say, the number is 395 (3 digit number) . The status of the summation of its digits is (3+9+5 = 17) odd. And the status of the number of digits is also odd. So it is safe to push the button.
Now, you are a brilliant programmer. Molly hired you to find out the numbers that are “Safe to push”. Otherwise say “BOOM”.
First line contains the number of test cases T (1 ≤ T ≤ 1000). The following T lines each contains an integer n (1 ≤ n ≤ 105).
Print the case number and “Safe to push” if it is safe. Otherwise print “BOOM” (without the quotation mark) .
3 395 2017 4
Case 1: Safe to push Case 2: Safe to push Case 3: BOOM