




'''simple docstring'''



import math







def      _UpperCamelCase	(_lowerCamelCase							:       int		)->				int:




     '''simple docstring'''





     return sum(int(_lowerCamelCase		) for digit in str(_lowerCamelCase		)		)







def      _UpperCamelCase	(_lowerCamelCase							:       int = 30		)->				int:




     '''simple docstring'''





     __snake_case         =					[]
     for digit in range(2				,		1_00		):
          for power in range(2				,		1_00		):
               __snake_case         =					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())









'''simple docstring'''



from __future__ import annotations

from collections.abc import Iterator
from typing import Any





class       lowerCAmelCase				:


       def __init__(				self      ,					__SCREAMING_SNAKE_CASE					) ->					None:



            '''simple docstring'''




            __snake_case         =					data
            __snake_case         =					None




       def __str__(				self					) ->					str:



            '''simple docstring'''




            return F'''{self.data}'''





class       lowerCAmelCase				:


       def __init__(				self					) ->					None:



            '''simple docstring'''




            __snake_case         =					None
            __snake_case         =					None


       def __iter__(				self					) ->					Iterator[Any]:



            '''simple docstring'''




            __snake_case         =					self.front
            while node:
                 yield node.data
                 __snake_case         =					node.next


       def __len__(				self					) ->					int:



            '''simple docstring'''




            return len(tuple(iter(self					)					)					)


       def __str__(				self					) ->					str:



            '''simple docstring'''




            return " <- ".join(str(__SCREAMING_SNAKE_CASE					) for item in self					)


       def  lowerCAmelCase (				self					) ->					bool:



            '''simple docstring'''




            return len(self					) == 0


       def  lowerCAmelCase (				self      ,					__SCREAMING_SNAKE_CASE					) ->					None:



            '''simple docstring'''




            __snake_case         =					Node(__SCREAMING_SNAKE_CASE					)
            if self.is_empty():
                 __snake_case         =					__snake_case         =					node
            else:
                 assert isinstance(self.rear      ,					__SCREAMING_SNAKE_CASE					)
                 __snake_case         =					node
                 __snake_case         =					node


       def  lowerCAmelCase (				self					) ->					Any:



            '''simple docstring'''




            if self.is_empty():
                 raise IndexError('''dequeue from empty queue'''					)
            assert isinstance(self.front      ,					__SCREAMING_SNAKE_CASE					)
            __snake_case         =					self.front
            __snake_case         =					self.front.next
            if self.front is None:
                 __snake_case         =					None
            return node.data




       def  lowerCAmelCase (				self					) ->					None:



            '''simple docstring'''




            __snake_case         =					__snake_case         =					None


if __name__ == "__main__":
     from doctest import testmod

     testmod()






