





import os
import sys
import time

from . import transposition_cipher as trans_cipher







def  A					(				):
					_snake_case							:       List[str]												= "Prehistoric Men.txt"
					_snake_case							:       List[str]												= "Output.txt"
					_snake_case							:       List[Any]												= int(input("Enter key: "					)					)
					_snake_case							:       List[Any]												= input("Encrypt/Decrypt [e/d]: "					)

					if not os.path.exists(UpperCAmelCase					):
										print(F"""File {input_file} does not exist. Quitting..."""					)
										sys.exit()
					if os.path.exists(UpperCAmelCase					):
										print(F"""Overwrite {output_file}? [y/n]"""					)
										_snake_case							:       Union[str, Any]												= input("> "					)
										if not response.lower().startswith("y"					):
															sys.exit()

					_snake_case							:       int												= time.time()
					if mode.lower().startswith("e"					):
										with open(UpperCAmelCase					) as f:
															_snake_case							:       List[str]												= f.read()
										_snake_case							:       Tuple												= trans_cipher.encrypt_message(UpperCAmelCase	,	UpperCAmelCase					)
					elif mode.lower().startswith("d"					):
										with open(UpperCAmelCase					) as f:
															_snake_case							:       int												= f.read()
										_snake_case							:       Optional[int]												= trans_cipher.decrypt_message(UpperCAmelCase	,	UpperCAmelCase					)

					with open(UpperCAmelCase	,	"w"					) as output_obj:
										output_obj.write(UpperCAmelCase					)

					_snake_case							:       Optional[int]												= round(time.time() - start_time	,	2					)
					print(("Done (", total_time, "seconds )")					)


if __name__ == "__main__":
							main()






def  A					(				UpperCAmelCase					):
					if not isinstance(UpperCAmelCase	,	UpperCAmelCase					):
										_snake_case							:       Optional[Any]												= F"""Input value of [number={number}] must be an integer"""
										raise TypeError(UpperCAmelCase					)
					if number < 1:
										raise ValueError("Input must be a positive integer"					)
					return number * (2 * number - 1)


if __name__ == "__main__":
							import doctest

							doctest.testmod()