

import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
     import ctypes
     import msvcrt  # noqa



     class 						_A     (				ctypes.Structure				):





       '''simple docstring'''



       __lowerCamelCase			:      Union[str, Any]					=   [('''size''', ctypes.c_int), ('''visible''', ctypes.c_byte)]







def       lowercase					(	)				->			Optional[Any]:





    '''simple docstring'''




    if os.name == "nt":
        snake_case							:		int        =		CursorInfo()
        snake_case							:		Union[str, Any]        =		ctypes.windll.kernelaa.GetStdHandle(-11		)
        ctypes.windll.kernelaa.GetConsoleCursorInfo(__A ,    ctypes.byref(__A		)		)
        snake_case							:		Union[str, Any]        =		False
        ctypes.windll.kernelaa.SetConsoleCursorInfo(__A ,    ctypes.byref(__A		)		)
    elif os.name == "posix":
        sys.stdout.write("""\033[?25l"""		)
        sys.stdout.flush()







def       lowercase					(	)				->			Tuple:





    '''simple docstring'''




    if os.name == "nt":
        snake_case							:		Optional[Any]        =		CursorInfo()
        snake_case							:		Dict        =		ctypes.windll.kernelaa.GetStdHandle(-11		)
        ctypes.windll.kernelaa.GetConsoleCursorInfo(__A ,    ctypes.byref(__A		)		)
        snake_case							:		Optional[int]        =		True
        ctypes.windll.kernelaa.SetConsoleCursorInfo(__A ,    ctypes.byref(__A		)		)
    elif os.name == "posix":
        sys.stdout.write("""\033[?25h"""		)
        sys.stdout.flush()







@contextmanager
def       lowercase					(	)				->			Union[str, Any]:





    '''simple docstring'''




    try:
        hide_cursor()
        yield
    finally:
        show_cursor()




"""simple docstring"""






def      UpperCAmelCase__			(							lowerCAmelCase__	:int = 1_0**9						)					->       int:
      '''simple docstring'''


      lowercase								=      1
      lowercase								=      2

      lowercase								=      0
      lowercase								=      0
      lowercase								=      0
      while perimeter <= max_perimeter:
            perimeters_sum += perimeter

            prev_value += 2 * value
            value += prev_value

            lowercase								=      2 * value + 2 if i % 2 == 0 else 2 * value - 2
            i += 1

      return perimeters_sum


if __name__ == "__main__":
       print(F"""{solution() = }""")



