 Given a positive integer N, raise each of its digits to the Kth power and sum those values to get S_{K}(N). For example, S_{2}(65) = 6^{2} + 5^{2} = 61. Now, consider a sequence N, S_{K}(N), S_{K}(S_{K}(N)) and so on. The happiness of N with respect to K is the smallest number in this sequence.
You will be given three ints A, B and K. Calculate the happiness of each integer between A and B, inclusive, with respect to K and return their sum.

  Returns: 14  The sequences for numbers 1 to 5 are:
1: 1, 1, 1...
2: 2, 4, 16, 37, 58, 89, 145, 42, 20, 4...
3: 3, 9, 81, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37...
4: 4, 16, 37, 58, 89, 145, 42, 20, 4...
5: 5, 25, 29, 85, 89, 145, 42, 20, 4, 16, 37, 58, 89...


