


'''simple docstring'''







from itertools import permutations







def _UpperCamelCase			(	__A = 5       )				->						int:


      '''simple docstring'''



      if gon_side < 3 or gon_side > 5:
            raise ValueError("gon_side must be in the range [3, 5]"       )

      # Since it's 16, we know 10 is on the outer ring
      # Put the big numbers at the end so that they are never the first number
      UpperCamelCase__      =							list(range(gon_side + 1 ,     0 ,     -1       )       )
      UpperCamelCase__      =							list(range(gon_side + 2 ,     gon_side * 2 + 1       )       )

      for perm in permutations(small_numbers + big_numbers       ):
            UpperCamelCase__      =							generate_gon_ring(__lowerCamelCase ,     list(__lowerCamelCase       )       )
            if is_magic_gon(__lowerCamelCase       ):
                  return int("".join(str(__lowerCamelCase       ) for n in numbers       )       )

      UpperCamelCase__      =							F'''Magic {gon_side}-gon ring is impossible'''
      raise ValueError(__lowerCamelCase       )







def _UpperCamelCase			(	__A ,     __A       )				->						list[int]:


      '''simple docstring'''



      UpperCamelCase__      =							[0] * (gon_side * 3)
      UpperCamelCase__      =							perm[0:3]
      perm.append(perm[1]       )

      UpperCamelCase__      =							1 if gon_side < 5 else 2

      for i in range(1 ,     len(__lowerCamelCase       ) // 3 + magic_number       ):
            UpperCamelCase__      =							perm[2 * i + 1]
            UpperCamelCase__      =							result[3 * i - 1]
            UpperCamelCase__      =							perm[2 * i + 2]

      return result







def _UpperCamelCase			(	__A       )				->						bool:


      '''simple docstring'''



      if len(__lowerCamelCase       ) % 3 != 0:
            raise ValueError("a gon ring should have a length that is a multiple of 3"       )

      if min(numbers[::3]       ) != numbers[0]:
            return False

      UpperCamelCase__      =							sum(numbers[:3]       )

      return all(sum(numbers[i : i + 3]       ) == total for i in range(3 ,     len(__lowerCamelCase       ) ,     3       )       )


if __name__ == "__main__":
  print(solution())









'''simple docstring'''

import os
import sys
import time

from . import transposition_cipher as trans_cipher






def __UpperCamelCase (      )   ->  None:







     '''simple docstring'''






     _a            =		"Prehistoric Men.txt"
     _a            =		"Output.txt"
     _a            =		int(input("Enter key: "					)					)
     _a            =		input("Encrypt/Decrypt [e/d]: "					)

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

     _a            =		time.time()
     if mode.lower().startswith("e"					):
          with open(__lowerCamelCase					) as f:
               _a            =		f.read()
          _a            =		trans_cipher.encrypt_message(__lowerCamelCase   ,	__lowerCamelCase					)
     elif mode.lower().startswith("d"					):
          with open(__lowerCamelCase					) as f:
               _a            =		f.read()
          _a            =		trans_cipher.decrypt_message(__lowerCamelCase   ,	__lowerCamelCase					)

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

     _a            =		round(time.time() - start_time   ,	2					)
     print(("Done (", total_time, "seconds )")					)


if __name__ == "__main__":
   main()

