






'''simple docstring'''







import re

from flax.core.frozen_dict import freeze
from flax.traverse_util import flatten_dict, unflatten_dict
from jax.experimental import PartitionSpec as P


# Sentinels
_A     :      Union[str, Any]   					=object()

# For specifying empty leaf dict `{}`
_A     :      Any   					=object()





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase				)				->	Dict:
							lowerCamelCase__ :     Tuple	  =	tuple((re.compile(x + """$"""				) for x in qs)				)
							for i in range(len(UpperCamelCase				) - len(UpperCamelCase				) + 1				):
														lowerCamelCase__ :     Optional[Any]	  =	[x.match(UpperCamelCase				) for x, y in zip(UpperCamelCase    ,      ks[i:]				)]
														if matches and all(UpperCamelCase				):
																					return True
							return False





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase				)				->	List[Any]:
							def replace(UpperCamelCase    ,      UpperCamelCase				):
														for rule, replacement in rules:
																					if _match(UpperCamelCase    ,      UpperCamelCase				):
																												return replacement
														return val

							return replace





def 			SCREAMING_SNAKE_CASE_	()				->	Optional[int]:
							return [
							    # embeddings
							    (("transformer", "wpe", "embedding"), P("""mp"""    ,      UpperCamelCase				)),
							    (("transformer", "wte", "embedding"), P("""mp"""    ,      UpperCamelCase				)),
							    # atention
							    (("attention", "(q_proj|k_proj|v_proj)", "kernel"), P(UpperCamelCase    ,      """mp"""				)),
							    (("attention", "out_proj", "kernel"), P("""mp"""    ,      UpperCamelCase				)),
							    (("attention", "out_proj", "bias"), None),
							    # mlp
							    (("mlp", "c_fc", "kernel"), P(UpperCamelCase    ,      """mp"""				)),
							    (("mlp", "c_fc", "bias"), P("""mp"""				)),
							    (("mlp", "c_proj", "kernel"), P("""mp"""    ,      UpperCamelCase				)),
							    (("mlp", "c_proj", "bias"), None),
							    # layer norms
							    ((r"ln_\d+", "bias"), None),
							    ((r"\d+", r"ln_\d+", "scale"), None),
							    (("ln_f", "bias"), None),
							    (("ln_f", "scale"), None),
							]





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase				)				->	int:
							lowerCamelCase__ :     Any	  =	_get_partition_rules()
							lowerCamelCase__ :     List[str]	  =	_replacement_rules(UpperCamelCase				)
							lowerCamelCase__ :     List[Any]	  =	{k: _unmatched for k in flatten_dict(UpperCamelCase				)}
							lowerCamelCase__ :     Optional[Any]	  =	{k: replace(UpperCamelCase    ,      UpperCamelCase				) for k, v in initd.items()}
							assert _unmatched not in result.values(), "Incomplete partition spec."
							return freeze(unflatten_dict(UpperCamelCase				)				)









'''simple docstring'''







from __future__ import annotations





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase				)				->	list[str]:
							if nth_term == "":
														return [""]
							lowerCamelCase__ :     str	  =	int(UpperCamelCase				)
							lowerCamelCase__ :     Union[str, Any]	  =	int(UpperCamelCase				)
							lowerCamelCase__ :     list[str]	  =	[]
							for temp in range(int(UpperCamelCase				)				):
														series.append(f'''1 / {pow(temp + 1    ,      int(UpperCamelCase				)				)}''' if series else """1"""				)
							return series


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			_A     :      Optional[Any]   					=int(input('''Enter the last number (nth term) of the P-Series'''))
			_A     :      List[str]   					=int(input('''Enter the power for  P-Series'''))
			print('''Formula of P-Series => 1+1/2^p+1/3^p ..... 1/n^p''')
			print(p_series(nth_term, power))

