uva10591測資B

Input:
30
1
5
11
27
79
37
653
349
514
123
9521
8881
1674
5566
31003
61099
87895
157893
532516
4627812
6698574
5587499
34059238
60655272
664851561
671511394
594387211
999990002
999990003
999990008
Output:
Case #1: 1 is a Happy number.
Case #2: 5 is an Unhappy number.
Case #3: 11 is an Unhappy number.
Case #4: 27 is an Unhappy number.
Case #5: 79 is a Happy number.
Case #6: 37 is an Unhappy number.
Case #7: 653 is a Happy number.
Case #8: 349 is an Unhappy number.
Case #9: 514 is an Unhappy number.
Case #10: 123 is an Unhappy number.
Case #11: 9521 is an Unhappy number.
Case #12: 8881 is a Happy number.
Case #13: 1674 is an Unhappy number.
Case #14: 5566 is an Unhappy number.
Case #15: 31003 is a Happy number.
Case #16: 61099 is an Unhappy number.
Case #17: 87895 is an Unhappy number.
Case #18: 157893 is an Unhappy number.
Case #19: 532516 is a Happy number.
Case #20: 4627812 is an Unhappy number.
Case #21: 6698574 is an Unhappy number.
Case #22: 5587499 is an Unhappy number.
Case #23: 34059238 is a Happy number.
Case #24: 60655272 is an Unhappy number.
Case #25: 664851561 is an Unhappy number.
Case #26: 671511394 is a Happy number.
Case #27: 594387211 is an Unhappy number.
Case #28: 999990002 is a Happy number.
Case #29: 999990003 is an Unhappy number.
Case #30: 999990008 is a Happy number.