


"""simple docstring"""
from __future__ import annotations






def 						lowercase				(	_snake_case		: int	,  _snake_case		: int	,  _snake_case		: int	)	->tuple[float, float]:
	"""simple docstring"""





	assert (
	    c % greatest_common_divisor(_snake_case	,  _snake_case	) == 0
	)  # greatest_common_divisor(a,b) function implemented below
	((__snake_case)      ,				(__snake_case)      ,				(__snake_case))      :		List[Any]         =							extended_gcd(_snake_case	,  _snake_case	)  # extended_gcd(a,b) function implemented below
	__snake_case      :		Union[str, Any]         =							c / d
	return (r * x, r * y)






def 						lowercase				(	_snake_case		: int	,  _snake_case		: int	,  _snake_case		: int	,  _snake_case		: int = 2	)	->None:
	"""simple docstring"""





	((__snake_case)      ,				(__snake_case))      :		Tuple         =							diophantine(_snake_case	,  _snake_case	,  _snake_case	)  # Initial value
	__snake_case      :		Optional[int]         =							greatest_common_divisor(_snake_case	,  _snake_case	)
	__snake_case      :		Optional[int]         =							a // d
	__snake_case      :		int         =							b // d

	for i in range(_snake_case	):
		__snake_case      :		Tuple         =							xa + i * q
		__snake_case      :		Optional[int]         =							ya - i * p
		print(_snake_case	,  _snake_case	)






def 						lowercase				(	_snake_case		: int	,  _snake_case		: int	)	->int:
	"""simple docstring"""





	if a < b:
		__snake_case      ,				__snake_case      :		Any         =							b, a

	while a % b != 0:
		__snake_case      ,				__snake_case      :		Any         =							b, a % b

	return b






def 						lowercase				(	_snake_case		: int	,  _snake_case		: int	)	->tuple[int, int, int]:
	"""simple docstring"""





	assert a >= 0 and b >= 0

	if b == 0:
		__snake_case      ,				__snake_case      ,				__snake_case      :		Tuple         =							a, 1, 0
	else:
		((__snake_case)      ,				(__snake_case)      ,				(__snake_case))      :		Optional[Any]         =							extended_gcd(_snake_case	,  a % b	)
		__snake_case      :		Optional[int]         =							q
		__snake_case      :		Any         =							p - q * (a // b)

	assert a % d == 0 and b % d == 0
	assert d == a * x + b * y

	return (d, x, y)


if __name__ == "__main__":
			from doctest import testmod

			testmod(name="""diophantine""", verbose=True)
			testmod(name="""diophantine_all_soln""", verbose=True)
			testmod(name="""extended_gcd""", verbose=True)
			testmod(name="""greatest_common_divisor""", verbose=True)








def      snake_case__							(  lowerCAmelCase_,       lowerCAmelCase_     ):





     """simple docstring"""







     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('plaintext must be a string'     )
     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('key must be a string'     )

     if not plaintext:
          raise ValueError('plaintext is empty'     )
     if not key:
          raise ValueError('key is empty'     )

     key += plaintext
     SCREAMING_SNAKE_CASE 		=plaintext.lower()
     SCREAMING_SNAKE_CASE 		=key.lower()
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=''
     while plaintext_iterator < len(lowerCAmelCase_     ):
          if (
              ord(plaintext[plaintext_iterator]     ) < 97
              or ord(plaintext[plaintext_iterator]     ) > 122
          ):
               ciphertext += plaintext[plaintext_iterator]
               plaintext_iterator += 1
          elif ord(key[key_iterator]     ) < 97 or ord(key[key_iterator]     ) > 122:
               key_iterator += 1
          else:
               ciphertext += chr(
                   (
                       (ord(plaintext[plaintext_iterator]     ) - 97 + ord(key[key_iterator]     ))
                       - 97
                   )
                   % 26
                   + 97     )
               key_iterator += 1
               plaintext_iterator += 1
     return ciphertext







def      snake_case__							(  lowerCAmelCase_,       lowerCAmelCase_     ):





     """simple docstring"""







     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('ciphertext must be a string'     )
     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('key must be a string'     )

     if not ciphertext:
          raise ValueError('ciphertext is empty'     )
     if not key:
          raise ValueError('key is empty'     )

     SCREAMING_SNAKE_CASE 		=key.lower()
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=''
     while ciphertext_iterator < len(lowerCAmelCase_     ):
          if (
              ord(ciphertext[ciphertext_iterator]     ) < 97
              or ord(ciphertext[ciphertext_iterator]     ) > 122
          ):
               plaintext += ciphertext[ciphertext_iterator]
          else:
               plaintext += chr(
                   (ord(ciphertext[ciphertext_iterator]     ) - ord(key[key_iterator]     )) % 26
                   + 97     )
               key += chr(
                   (ord(ciphertext[ciphertext_iterator]     ) - ord(key[key_iterator]     )) % 26
                   + 97     )
               key_iterator += 1
          ciphertext_iterator += 1
     return plaintext


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 _lowerCamelCase							=int(input("Type 1 to encrypt or 2 to decrypt:"))
 if operation == 1:
  _lowerCamelCase							=input("Typeplaintext to be encrypted:\n")
  _lowerCamelCase							=input("Type the key:\n")
  print(encrypt(plaintext, key))
 elif operation == 2:
  _lowerCamelCase							=input("Type the ciphertext to be decrypted:\n")
  _lowerCamelCase							=input("Type the key:\n")
  print(decrypt(ciphertext, key))
 decrypt("jsqqs avvwo", "coffee")

