import itertools







def 						UpperCAmelCase							(		lowerCAmelCase_ = 1_0_0_0_0_0_0							)						->						int:
     a	:     Optional[int]						      =    [1]

     for i in itertools.count(len(lowerCAmelCase_							)							):
          a	:     Tuple						      =    0
          for j in itertools.count(1							):
               a	:     Dict						      =    -1 if j % 2 == 0 else +1
               a	:     Union[str, Any]						      =    (j * j * 3 - j) // 2
               if index > i:
                    break
               item += partitions[i - index] * sign
               item %= number
               index += j
               if index > i:
                    break
               item += partitions[i - index] * sign
               item %= number

          if item == 0:
               return i
          partitions.append(lowerCAmelCase_							)

     return 0


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  print(F'''{solution() = }''')
import math







def 						UpperCAmelCase							(		lowerCAmelCase_							)						->						int:
     return sum(int(lowerCAmelCase_							) for digit in str(lowerCAmelCase_							)							)







def 						UpperCAmelCase							(		lowerCAmelCase_ = 3_0							)						->						int:
     a	:     Optional[int]						      =    []
     for digit in range(2    ,   1_0_0							):
          for power in range(2    ,   1_0_0							):
               a	:     List[str]						      =    int(math.pow(lowerCAmelCase_    ,   lowerCAmelCase_							)							)
               if digit == digit_sum(lowerCAmelCase_							):
                    digit_to_powers.append(lowerCAmelCase_							)

     digit_to_powers.sort()
     return digit_to_powers[n - 1]


if __name__ == "__main__":
  print(solution())