




from __future__ import annotations

from collections.abc import Iterator
from typing import Any

class      UpperCAmelCase						:






   def __init__(	self   :       Union[str, Any]						,					UpperCamelCase_   :       Any     )->			None:
     _lowercase: Any						     =    data
     _lowercase: Node | None						     =    None






   def __str__(	self   :       Dict     )->			str:
     return f'{self.data}'

class      UpperCAmelCase						:






   def __init__(	self   :       Optional[int]     )->			None:
     _lowercase: Node | None						     =    None
     _lowercase: Node | None						     =    None






   def __iter__(	self   :       Dict     )->			Iterator[Any]:
     _lowercase: Optional[int]						     =    self.front
     while node:
       yield node.data
       _lowercase: Optional[int]						     =    node.next






   def __len__(	self   :       Tuple     )->			int:
     return len(tuple(iter(self     )     )     )






   def __str__(	self   :       Union[str, Any]     )->			str:
     return " <- ".join(str(UpperCamelCase_     ) for item in self     )






   def  _a						(	self   :       Any     )->			bool:
     return len(self     ) == 0






   def  _a						(	self   :       Dict						,					UpperCamelCase_   :       Any     )->			None:
     _lowercase: List[Any]						     =    Node(UpperCamelCase_     )
     if self.is_empty():
       _lowercase: List[str]						     =    node
     else:
       assert isinstance(self.rear						,					UpperCamelCase_     )
       _lowercase: Union[str, Any]						     =    node
       _lowercase: Dict						     =    node






   def  _a						(	self   :       Optional[Any]     )->			Any:
     if self.is_empty():
       raise IndexError('dequeue from empty queue'     )
     assert isinstance(self.front						,					UpperCamelCase_     )
     _lowercase: str						     =    self.front
     _lowercase: str						     =    self.front.next
     if self.front is None:
       _lowercase: List[Any]						     =    None
     return node.data






   def  _a						(	self   :       Any     )->			None:
     _lowercase: List[Any]						     =    None


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

   testmod()






import math


def 		_lowerCamelCase				(					UpperCamelCase							)			->		int:





  """simple docstring"""





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


def 		_lowerCamelCase				(					UpperCamelCase = 30							)			->		int:





  """simple docstring"""





  _lowercase: int						     =    []
  for digit in range(2					,     100							):
    for power in range(2					,     100							):
      _lowercase: int						     =    int(math.pow(UpperCamelCase					,     UpperCamelCase							)							)
      if digit == digit_sum(UpperCamelCase							):
        digit_to_powers.append(UpperCamelCase							)

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


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