uva10591測資A

Input:
30
7
4
13
14
65
68
70
49
661
172
885
5073
6049
3182
44939
66051
72798
191111
399112
989111
7115614
2361555
1556722
21374902
94373385
50558519
104396047
520797609
999994554
999991118
Output:
Case #1: 7 is a Happy number.
Case #2: 4 is an Unhappy number.
Case #3: 13 is a Happy number.
Case #4: 14 is an Unhappy number.
Case #5: 65 is an Unhappy number.
Case #6: 68 is a Happy number.
Case #7: 70 is a Happy number.
Case #8: 49 is a Happy number.
Case #9: 661 is an Unhappy number.
Case #10: 172 is an Unhappy number.
Case #11: 885 is an Unhappy number.
Case #12: 5073 is an Unhappy number.
Case #13: 6049 is a Happy number.
Case #14: 3182 is an Unhappy number.
Case #15: 44939 is a Happy number.
Case #16: 66051 is an Unhappy number.
Case #17: 72798 is an Unhappy number.
Case #18: 191111 is a Happy number.
Case #19: 399112 is an Unhappy number.
Case #20: 989111 is an Unhappy number.
Case #21: 7115614 is a Happy number.
Case #22: 2361555 is an Unhappy number.
Case #23: 1556722 is an Unhappy number.
Case #24: 21374902 is an Unhappy number.
Case #25: 94373385 is a Happy number.
Case #26: 50558519 is an Unhappy number.
Case #27: 104396047 is a Happy number.
Case #28: 520797609 is an Unhappy number.
Case #29: 999994554 is a Happy number.
Case #30: 999991118 is an Unhappy number.