code: 
  
  
  """simple docstring"""
  
  
  
  
  import os
  import sys
  
  from . import rsa_key_generator as rkg
  
  __magic_name__          =							1_2_8
  __magic_name__          =							2_5_6
  
  
  
  
  
  def 			a_   (  lowercase__   :List[str], lowercase__   :Optional[int] = DEFAULT_BLOCK_SIZE    ):
  			__lowerCamelCase        =			message.encode("""ascii"""    )
  
  			__lowerCamelCase        =			[]
  			for block_start in range(0, len(snake_case__    ), snake_case__    ):
  						__lowerCamelCase        =			0
  						for i in range(snake_case__, min(block_start + block_size, len(snake_case__    )    )    ):
  									block_int += message_bytes[i] * (BYTE_SIZE ** (i % block_size))
  						block_ints.append(snake_case__    )
  			return block_ints
  
  
  
  
  
  def 			a_   (  lowercase__   :Optional[int], lowercase__   :int, lowercase__   :List[Any] = DEFAULT_BLOCK_SIZE    ):
  			__lowerCamelCase        =			[]
  			for block_int in block_ints:
  						__lowerCamelCase        =			[]
  						for i in range(block_size - 1, -1, -1    ):
  									if len(snake_case__    ) + i < message_length:
  												__lowerCamelCase        =			block_int // (BYTE_SIZE**i)
  												__lowerCamelCase        =			block_int % (BYTE_SIZE**i)
  												block_message.insert(0, chr(snake_case__    )    )
  						message.extend(snake_case__    )
  			return "".join(snake_case__    )
  
  
  
  
  
  def 			a_   (  lowercase__   :Optional[Any], lowercase__   :Dict, lowercase__   :Union[str, Any] = DEFAULT_BLOCK_SIZE    ):
  			__lowerCamelCase        =			[]
  			__lowerCamelCase    ,__lowerCamelCase        =			key
  
  			for block in get_blocks_from_text(snake_case__, snake_case__    ):
  						encrypted_blocks.append(pow(snake_case__, snake_case__, snake_case__    )    )
  			return encrypted_blocks
  
  
  
  
  
  def 			a_   (  lowercase__   :Tuple, lowercase__   :Optional[Any], lowercase__   :List[Any], lowercase__   :Tuple = DEFAULT_BLOCK_SIZE, ):
  			__lowerCamelCase        =			[]
  			__lowerCamelCase    ,__lowerCamelCase        =			key
  			for block in encrypted_blocks:
  						decrypted_blocks.append(pow(snake_case__, snake_case__, snake_case__    )    )
  			return get_text_from_blocks(snake_case__, snake_case__, snake_case__    )
  
  
  
  
  
  def 			a_   (  lowercase__   :Any    ):
  			with open(snake_case__    ) as fo:
  						__lowerCamelCase        =			fo.read()
  			__lowerCamelCase    ,__lowerCamelCase    ,__lowerCamelCase        =			content.split(""","""    )
  			return (int(snake_case__    ), int(snake_case__    ), int(snake_case__    ))
  
  
  
  
  
  def 			a_   (  lowercase__   :Any, lowercase__   :Tuple, lowercase__   :Optional[int], lowercase__   :int = DEFAULT_BLOCK_SIZE, ):
  			__lowerCamelCase    ,__lowerCamelCase    ,__lowerCamelCase        =			read_key_file(snake_case__    )
  			if key_size < block_size * 8:
  						sys.exit(
  						    """ERROR: Block size is {} bits and key size is {} bits. The RSA cipher """
  						    """requires the block size to be equal to or greater than the key size. """
  						    """Either decrease the block size or use different keys.""".format(
  						        block_size * 8, snake_case__    )    )
  
  			__lowerCamelCase        =			[str(snake_case__    ) for i in encrypt_message(snake_case__, (n, e), snake_case__    )]
  
  			__lowerCamelCase        =			""",""".join(snake_case__    )
  			__lowerCamelCase        =			f'{len(snake_case__    )}_{block_size}_{encrypted_content}'
  			with open(snake_case__, """w"""    ) as fo:
  						fo.write(snake_case__    )
  			return encrypted_content
  
  
  
  
  
  def 			a_   (  lowercase__   :List[Any], lowercase__   :Any    ):
  			__lowerCamelCase    ,__lowerCamelCase    ,__lowerCamelCase        =			read_key_file(snake_case__    )
  			with open(snake_case__    ) as fo:
  						__lowerCamelCase        =			fo.read()
  			__lowerCamelCase    ,__lowerCamelCase    ,__lowerCamelCase        =			content.split("""_"""    )
  			__lowerCamelCase        =			int(snake_case__    )
  			__lowerCamelCase        =			int(snake_case__    )
  
  			if key_size < block_size * 8:
  						sys.exit(
  						    """ERROR: Block size is {} bits and key size is {} bits. The RSA cipher """
  						    """requires the block size to be equal to or greater than the key size. """
  						    """Did you specify the correct key file and encrypted file?""".format(
  						        block_size * 8, snake_case__    )    )
  
  			__lowerCamelCase        =			[]
  			for block in encrypted_message.split(""","""    ):
  						encrypted_blocks.append(int(snake_case__    )    )
  
  			return decrypt_message(snake_case__, snake_case__, (n, d), snake_case__    )
  
  
  
  
  
  def 			a_   (  ):
  			__lowerCamelCase        =			"""encrypted_file.txt"""
  			__lowerCamelCase        =			input(r"""Encrypt\Decrypt [e\d]: """    )
  
  			if response.lower().startswith("""e"""    ):
  						__lowerCamelCase        =			"""encrypt"""
  			elif response.lower().startswith("""d"""    ):
  						__lowerCamelCase        =			"""decrypt"""
  
  			if mode == "encrypt":
  						if not os.path.exists("""rsa_pubkey.txt"""    ):
  									rkg.make_key_files("""rsa""", 1024    )
  
  						__lowerCamelCase        =			input("""\nEnter message: """    )
  						__lowerCamelCase        =			"""rsa_pubkey.txt"""
  						print(f'Encrypting and writing to {filename}...'    )
  						__lowerCamelCase        =			encrypt_and_write_to_file(snake_case__, snake_case__, snake_case__    )
  
  						print("""\nEncrypted text:"""    )
  						print(snake_case__    )
  
  			elif mode == "decrypt":
  						__lowerCamelCase        =			"""rsa_privkey.txt"""
  						print(f'Reading from {filename} and decrypting...'    )
  						__lowerCamelCase        =			read_from_file_and_decrypt(snake_case__, snake_case__    )
  						print("""writing decryption to rsa_decryption.txt..."""    )
  						with open("""rsa_decryption.txt""", """w"""    ) as dec:
  									dec.write(snake_case__    )
  
  						print("""\nDecryption:"""    )
  						print(snake_case__    )
  
  
  if __name__ == "__main__":
  					main()
  
  
  
  
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  import os
  
  
  
  
  
  def 			a_   (  ):
  			__lowerCamelCase        =			os.path.dirname(os.path.realpath(lowercase__    )    )
  			__lowerCamelCase        =			os.path.join(lowercase__, """triangle.txt"""    )
  
  			with open(lowercase__    ) as in_file:
  						__lowerCamelCase        =			[[int(lowercase__    ) for i in line.split()] for line in in_file]
  
  			while len(lowercase__    ) != 1:
  						__lowerCamelCase        =			triangle.pop()
  						__lowerCamelCase        =			triangle[-1]
  						for j in range(len(lowercase__    ) - 1    ):
  									curr_row[j] += max(last_row[j], last_row[j + 1]    )
  			return triangle[0][0]
  
  
  if __name__ == "__main__":
  					print(solution())
  
  
  
  
  