

'''simple docstring'''




def  lowerCamelCase__						(  SCREAMING_SNAKE_CASE :				List[str]    ,				SCREAMING_SNAKE_CASE :				Optional[int]    ,				SCREAMING_SNAKE_CASE :				Optional[int]  ):
  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

  UpperCAmelCase  							=		bin_exp_mod(SCREAMING_SNAKE_CASE    ,				n / 2    ,				SCREAMING_SNAKE_CASE  )
  return (r * r) % b


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

  print(bin_exp_mod(BASE, POWER, MODULO))





'''simple docstring'''




def  lowerCamelCase__						(  SCREAMING_SNAKE_CASE :				str  ):
  UpperCAmelCase  							=		str(SCREAMING_SNAKE_CASE  ).strip()
  if not bin_string:
    raise ValueError('Empty string was passed to the function'  )
  UpperCAmelCase  							=		bin_string[0] == '-'
  if is_negative:
    UpperCAmelCase  							=		bin_string[1:]
  if not all(char in '01' for char in bin_string  ):
    raise ValueError('Non-binary value was passed to the function'  )
  UpperCAmelCase  							=		0
  for char in bin_string:
    UpperCAmelCase  							=		2 * decimal_number + int(SCREAMING_SNAKE_CASE  )
  return -decimal_number if is_negative else decimal_number


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

  testmod()


