


'''simple docstring'''
from __future__ import annotations

import sys







def 			a_							(  UpperCamelCase_   ):
							if n < 0:
														raise ValueError("Negative arguments are not supported"   )
							return _fib(UpperCamelCase_   )[0]







def 			a_							(  UpperCamelCase_   ):
							if n == 0:  # (F(0), F(1))
														return (0, 1)

							# F(2n) = F(n)[2F(n+1) − F(n)]
							# F(2n+1) = F(n+1)^2+F(n)^2
							A_						,				A_ 						=		_fib(n // 2   )
							A_ 						=		a * (b * 2 - a)
							A_ 						=		a * a + b * b
							return (d, c + d) if n % 2 else (c, d)


if __name__ == "__main__":
							__SCREAMING_SNAKE_CASE				:							Any		       =		int(sys.argv[1])
							print(F"fibonacci({n}) is {fibonacci(n)}")









'''simple docstring'''
def 			a_							(  UpperCamelCase_	,     UpperCamelCase_ = 1_0_0_0   ):
							if (not isinstance(UpperCamelCase_	,     UpperCamelCase_   )) or (digit_position <= 0):
														raise ValueError("Digit position must be a positive integer"   )
							elif (not isinstance(UpperCamelCase_	,     UpperCamelCase_   )) 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
							A_ 						=		(
							    4 * _subsum(UpperCamelCase_	,     1	,     UpperCamelCase_   )
							    - 2 * _subsum(UpperCamelCase_	,     4	,     UpperCamelCase_   )
							    - _subsum(UpperCamelCase_	,     5	,     UpperCamelCase_   )
							    - _subsum(UpperCamelCase_	,     6	,     UpperCamelCase_   )
							)

							# return the first hex digit of the fractional part of the result
							return hex(int((sum_result % 1) * 1_6   )   )[2:]







def 			a_							(  UpperCamelCase_	,     UpperCamelCase_	,     UpperCamelCase_   ):
							A_ 						=		0.0
							for sum_index in range(digit_pos_to_extract + precision   ):
														A_ 						=		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
																					A_ 						=		pow(
																					    1_6	,     digit_pos_to_extract - 1 - sum_index	,     UpperCamelCase_   )
														else:
																					A_ 						=		pow(1_6	,     digit_pos_to_extract - 1 - sum_index   )
														total += exponential_term / denominator
							return total


if __name__ == "__main__":
							import doctest

							doctest.testmod()





