



"""simple docstring"""
def   A_    (     _lowercase,   _lowercase,   _lowercase,   _lowercase      ):







						'''simple docstring'''


						snake_case_					:Dict		=     int((lower_bound + upper_bound) // 2      )
						if array[r] == value:
												return r
						if lower_bound >= upper_bound:
												return -1
						if array[r] < value:
												return binary_search(_lowercase,   r + 1,   _lowercase,   _lowercase      )
						else:
												return binary_search(_lowercase,   _lowercase,   r - 1,   _lowercase      )
def   A_    (     _lowercase,   _lowercase      ):







						'''simple docstring'''


						snake_case_					:Any		=     0
						if matrix[index][0] == value:
												return [index, 0]
						while index < len(_lowercase      ) and matrix[index][0] < value:
												snake_case_					:List[str]		=     binary_search(matrix[index],   0,   len(matrix[index]      ) - 1,   _lowercase      )
												if r != -1:
																		return [index, r]
												index += 1
						return [-1, -1]


if __name__ == "__main__":
						import doctest

						doctest.testmod()





'''simple docstring'''







def  SCREAMING_SNAKE_CASE__ (				SCREAMING_SNAKE_CASE ,		SCREAMING_SNAKE_CASE ,		SCREAMING_SNAKE_CASE     ):
		assert b != 0, "This cannot accept modulo that is == 0"
		if n == 0:
				return 1

		if n % 2 == 1:
				return (bin_exp_mod(SCREAMING_SNAKE_CASE ,		n - 1 ,		SCREAMING_SNAKE_CASE     ) * a) % b

		SCREAMING_SNAKE_CASE_						:List[str]										=      bin_exp_mod(SCREAMING_SNAKE_CASE ,		n / 2 ,		SCREAMING_SNAKE_CASE     )
		return (r * r) % b


if __name__ == "__main__":
							try:
														SCREAMING_SNAKE_CASE__     : Any				=   int(input("""Enter Base : """).strip())
														SCREAMING_SNAKE_CASE__     : str				=   int(input("""Enter Power : """).strip())
														SCREAMING_SNAKE_CASE__     : List[Any]				=   int(input("""Enter Modulo : """).strip())
							except ValueError:
														print("""Invalid literal for integer""")

							print(bin_exp_mod(BASE, POWER, MODULO))
