






def 							A     (       a_							,a_							,a_					)     ->						Tuple:
					if n == 0:
										return 1

					elif n % 2 == 1:
										return (binary_exponentiation(a_							,n - 1							,a_					) * a) % mod

					else:
										__UpperCamelCase      :					Dict       		=binary_exponentiation(a_							,n / 2							,a_					)
										return (b * b) % mod


# a prime number
A_       :str       =						701

A_       :Optional[Any]       =						1000000000
A_       :int       =						10

# using binary exponentiation function, O(log(p)):
print((a / b) % p == (a * binary_exponentiation(b, p - 2, p)) % p)


print((a / b) % p == (a * b ** (p - 2)) % p)





from typing import Union

import fire
import torch
from tqdm import tqdm



def 	lowerCAmelCase       (						lowerCAmelCase_       ,      lowerCAmelCase_ = "cpu"       ,      lowerCAmelCase_ = None       )->       None:
				lowerCAmelCase_       :					str			 = torch.load(lowerCAmelCase_       ,      map_location=lowerCAmelCase_       )
				for k, v in tqdm(state_dict.items()       ):
								if not isinstance(lowerCAmelCase_       ,      torch.Tensor       ):
												raise TypeError('''FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin'''       )
								lowerCAmelCase_       :					int			 = v.half()
				if save_path is None:  # overwrite src_path
								lowerCAmelCase_       :					Tuple			 = src_path
				torch.save(lowerCAmelCase_       ,      lowerCAmelCase_       )


if __name__ == "__main__":
						fire.Fire(convert)