Happy Number

Let the sum of the square of the digits of a positive integer S0 be represented by S1. In a similar way, let thesumofthesquaresofthedigitsofS1 berepresentedbyS2 andsoon. IfSi =1forsomei≥1,then the original integer S0 is said to be Happy number. A number, which is not happy, is called Unhappy number. Forexample7isaHappynumbersince7→49→97→130→10→1and4isanUnhappy number since 4 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4. Input The input consists of several test cases, the number of which you are given in the first line of the input. Each test case consists of one line containing a single positive integer N smaller than 109. Output For each test case, you must print one of the following messages: Case #p: N is a Happy number. Case #p: N is an Unhappy number. Here p stands for the case number (starting from 1). You should print the first message if the number N is a happy number. Otherwise, print the second line. Sample Input 3 7 4 13 Sample Output Case #1: 7 is a Happy number. Case #2: 4 is an Unhappy number. Case #3: 13 is a Happy number.