#K14851. Magic Number Challenge
Magic Number Challenge
Magic Number Challenge
In this problem, you are given an integer n. Your task is to determine whether it is a Magic Number. A Magic Number satisfies the following two conditions:
- The sum of its digits is a prime number. In mathematical notation, if \( S(n) \) is the sum of the digits of \( n \), then \( S(n) \) must be a prime number.
- The number must contain the digit '7'.
If both conditions are satisfied, output MAGIC!
; otherwise, output NOT MAGIC!
.
inputFormat
The input consists of a single integer n provided through standard input (stdin).
outputFormat
Output a single line. Print 'MAGIC!' if the number is a Magic Number; otherwise, print 'NOT MAGIC!'.## sample
719
MAGIC!