

"""simple docstring"""






from typing import Any






class     _UpperCAmelCase			:
			def __init__(		self     )    ->    List[str]:






				'''simple docstring'''







				_UpperCAmelCase    :							Any									=					[]
				_UpperCAmelCase    :							int									=					0
			def __str__(		self     )    ->    int:






				'''simple docstring'''







				_UpperCAmelCase    :							Any									=					"""<""" + str(self.stack     )[1:-1] + """>"""
				return printed
			def 							__snake_case (		self      ,		_A     )    ->    None:






				'''simple docstring'''







				self.stack.append(_A     )
				_UpperCAmelCase    :							Tuple									=					self.length + 1
			def 							__snake_case (		self     )    ->    Any:






				'''simple docstring'''







				self.rotate(1     )
				_UpperCAmelCase    :							Optional[int]									=					self.stack[self.length - 1]
				_UpperCAmelCase    :							int									=					self.stack[:-1]
				self.rotate(self.length - 1     )
				_UpperCAmelCase    :							Tuple									=					self.length - 1
				return dequeued
			def 							__snake_case (		self      ,		_A     )    ->    None:






				'''simple docstring'''







				for _ in range(_A     ):
					_UpperCAmelCase    :							Optional[Any]									=					self.stack[0]
					_UpperCAmelCase    :							Dict									=					self.stack[1:]
					self.put(_A     )
					_UpperCAmelCase    :							Dict									=					self.length - 1
			def 							__snake_case (		self     )    ->    Any:






				'''simple docstring'''







				_UpperCAmelCase    :							int									=					self.get()
				self.put(_A     )
				self.rotate(self.length - 1     )
				return front
			def 							__snake_case (		self     )    ->    int:






				'''simple docstring'''







				return self.length






"""simple docstring"""






def       UpperCamelCase					(			_lowerCAmelCase     :						int,  _lowerCAmelCase     :						int = 1000 )				->			str:
	if (not isinstance(_lowerCAmelCase,  _lowerCAmelCase )) or (digit_position <= 0):
		raise ValueError("""Digit position must be a positive integer""" )
	elif (not isinstance(_lowerCAmelCase,  _lowerCAmelCase )) or (precision < 0):
		raise ValueError("""Precision must be a nonnegative integer""" )

	# compute an approximation of (16 ** (n - 1)) * pi whose fractional part is mostly
	# accurate
	_UpperCAmelCase    :							List[Any]									=					(
	    4 * _subsum(_lowerCAmelCase,  1,  _lowerCAmelCase )
	    - 2 * _subsum(_lowerCAmelCase,  4,  _lowerCAmelCase )
	    - _subsum(_lowerCAmelCase,  5,  _lowerCAmelCase )
	    - _subsum(_lowerCAmelCase,  6,  _lowerCAmelCase )
	)

	# return the first hex digit of the fractional part of the result
	return hex(int((sum_result % 1) * 16 ) )[2:]
def       UpperCamelCase					(			_lowerCAmelCase     :						int,  _lowerCAmelCase     :						int,  _lowerCAmelCase     :						int )				->			float:
	_UpperCAmelCase    :							Optional[int]									=					0.0
	for sum_index in range(digit_pos_to_extract + precision ):
		_UpperCAmelCase    :							Optional[Any]									=					8 * sum_index + denominator_addend
		if sum_index < digit_pos_to_extract:
			# if the exponential term is an integer and we mod it by the denominator
			# before dividing, only the integer part of the sum will change;
			# the fractional part will not
			_UpperCAmelCase    :							Optional[Any]									=					pow(
			    16,  digit_pos_to_extract - 1 - sum_index,  _lowerCAmelCase )
		else:
			_UpperCAmelCase    :							int									=					pow(16,  digit_pos_to_extract - 1 - sum_index )
		total += exponential_term / denominator
	return total


if __name__ == "__main__":
						import doctest

						doctest.testmod()





