





import math

class 		__a							:



       def __init__(     self	:   List[str]					,			UpperCAmelCase	:   Optional[Any]			):
           lowerCAmelCase_					:	List[Any]						=   len(UpperCAmelCase			)
           lowerCAmelCase_					:	Union[str, Any]						=   [0] * (
               4 * self.N
           )  # approximate the overall size of segment tree with array N
           self.build(1					,			0					,			self.N - 1			)



       def  A							(     self	:   List[Any]					,			UpperCAmelCase	:   List[Any]			):
           return idx * 2



       def  A							(     self	:   List[str]					,			UpperCAmelCase	:   int			):
           return idx * 2 + 1



       def  A							(     self	:   int					,			UpperCAmelCase	:   List[Any]					,			UpperCAmelCase	:   Union[str, Any]					,			UpperCAmelCase	:   Optional[int]			):  # noqa: E741
           if l == r:
               lowerCAmelCase_					:	Any						=   A[l]
           else:
               lowerCAmelCase_					:	List[Any]						=   (l + r) // 2
               self.build(self.left(UpperCAmelCase			)					,			UpperCAmelCase					,			UpperCAmelCase			)
               self.build(self.right(UpperCAmelCase			)					,			mid + 1					,			UpperCAmelCase			)
               lowerCAmelCase_					:	int						=   max(self.st[self.left(UpperCAmelCase			)]					,			self.st[self.right(UpperCAmelCase			)]			)



       def  A							(     self	:   Optional[int]					,			UpperCAmelCase	:   Any					,			UpperCAmelCase	:   List[str]					,			UpperCAmelCase	:   str			):
           return self.update_recursive(1					,			0					,			self.N - 1					,			a - 1					,			b - 1					,			UpperCAmelCase			)



       def  A							(     self	:   List[Any]					,			UpperCAmelCase	:   Tuple					,			UpperCAmelCase	:   Optional[int]					,			UpperCAmelCase	:   int					,			UpperCAmelCase	:   List[str]					,			UpperCAmelCase	:   List[str]					,			UpperCAmelCase	:   Any			):  # noqa: E741
           if r < a or l > b:
               return True
           if l == r:
               lowerCAmelCase_					:	Dict						=   val
               return True
           lowerCAmelCase_					:	int						=   (l + r) // 2
           self.update_recursive(self.left(UpperCAmelCase			)					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase			)
           self.update_recursive(self.right(UpperCAmelCase			)					,			mid + 1					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase			)
           lowerCAmelCase_					:	Optional[int]						=   max(self.st[self.left(UpperCAmelCase			)]					,			self.st[self.right(UpperCAmelCase			)]			)
           return True



       def  A							(     self	:   List[str]					,			UpperCAmelCase	:   int					,			UpperCAmelCase	:   str			):
           return self.query_recursive(1					,			0					,			self.N - 1					,			a - 1					,			b - 1			)



       def  A							(     self	:   Optional[int]					,			UpperCAmelCase	:   List[str]					,			UpperCAmelCase	:   Optional[Any]					,			UpperCAmelCase	:   int					,			UpperCAmelCase	:   Any					,			UpperCAmelCase	:   str			):  # noqa: E741
           if r < a or l > b:
               return -math.inf
           if l >= a and r <= b:
               return self.st[idx]
           lowerCAmelCase_					:	str						=   (l + r) // 2
           lowerCAmelCase_					:	Tuple						=   self.query_recursive(self.left(UpperCAmelCase			)					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase			)
           lowerCAmelCase_					:	List[str]						=   self.query_recursive(self.right(UpperCAmelCase			)					,			mid + 1					,			UpperCAmelCase					,			UpperCAmelCase					,			UpperCAmelCase			)
           return max(UpperCAmelCase					,			UpperCAmelCase			)



       def  A							(     self	:   Optional[Any]			):
           lowerCAmelCase_					:	Union[str, Any]						=   []
           for i in range(1					,			N + 1			):
               show_list += [self.query(UpperCAmelCase					,			UpperCAmelCase			)]
           print(UpperCAmelCase			)


if __name__ == "__main__":
  __UpperCAmelCase						=      [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
  __UpperCAmelCase						=      15
  __UpperCAmelCase						=      SegmentTree(A)
  print(segt.query(4, 6))
  print(segt.query(7, 11))
  print(segt.query(7, 12))
  segt.update(1, 3, 1_11)
  print(segt.query(1, 15))
  segt.update(7, 8, 2_35)
  segt.show_data()









from __future__ import annotations

import math
from itertools import permutations
def 			__UpperCamelCase				(			lowercase__	:       int		)	->      bool:
    '''simple docstring'''





    if 1 < number < 4:
        # 2 and 3 are primes
        return True
    elif number < 2 or number % 2 == 0 or number % 3 == 0:
        # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
        return False

    # All primes number are in format of 6k +/- 1
    for i in range(5		,    int(math.sqrt(lowercase__		) + 1		)		,    6		):
        if number % i == 0 or number % (i + 2) == 0:
            return False
    return True
def 			__UpperCamelCase				(			lowercase__	:       int = 7		)	->      int:
    '''simple docstring'''





    lowerCAmelCase_					:	str						=   """""".join(str(lowercase__		) for i in range(1		,    n + 1		)		)
    lowerCAmelCase_					:	Any						=   [int("""""".join(lowercase__		)		) for i in permutations(lowercase__		,    lowercase__		)]
    lowerCAmelCase_					:	List[Any]						=   [num for num in perm_list if is_prime(lowercase__		)]
    return max(lowercase__		) if pandigitals else 0


if __name__ == "__main__":
  print(f"""{solution() = }""")


