





from __future__ import annotations

import math
import random
from collections.abc import Collection
from typing import overload
class        SCREAMING_SNAKE_CASE     :


   def __init__(					self    :       Optional[int]    ,  a    :       Collection[float] | None = None )->     None:





     """simple docstring"""







     if components is None:
       lowercase__			    =						[]
     lowercase__			    =						list(a )


   def __len__(					self    :       int )->     int:





     """simple docstring"""







     return len(self.__components )


   def __str__(					self    :       Dict )->     str:





     """simple docstring"""







     return "(" + ",".join(map(a    ,  self.__components ) ) + ")"


   def __add__(					self    :       str    ,  a    :       Vector )->     Vector:





     """simple docstring"""







     lowercase__			    =						len(self )
     if size == len(a ):
       lowercase__			    =						[self.__components[i] + other.component(a ) for i in range(a )]
       return Vector(a )
     else:
       raise Exception('must have the same size' )


   def __sub__(					self    :       List[Any]    ,  a    :       Vector )->     Vector:





     """simple docstring"""







     lowercase__			    =						len(self )
     if size == len(a ):
       lowercase__			    =						[self.__components[i] - other.component(a ) for i in range(a )]
       return Vector(a )
     else:  # error case
       raise Exception('must have the same size' )


   @overload
   def __mul__(					self    :       List[str]    ,  a    :       float )->     Vector:





     """simple docstring"""







     ...


   @overload
   def __mul__(					self    :       Any    ,  a    :       Vector )->     float:





     """simple docstring"""







     ...


   def __mul__(					self    :       Optional[Any]    ,  a    :       float | Vector )->     float | Vector:





     """simple docstring"""







     if isinstance(a    ,  (float, int) ):
       lowercase__			    =						[c * other for c in self.__components]
       return Vector(a )
     elif isinstance(a    ,  a ) and len(self ) == len(a ):
       lowercase__			    =						len(self )
       lowercase__			    =						[self.__components[i] * other.component(a ) for i in range(a )]
       return sum(a )
     else:  # error case
       raise Exception('invalid operand!' )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[int] )->     Vector:





     """simple docstring"""







     return Vector(self.__components )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Union[str, Any]    ,  a    :       int )->     float:





     """simple docstring"""







     if isinstance(a    ,  a ) and -len(self.__components ) <= i < len(self.__components ):
       return self.__components[i]
     else:
       raise Exception('index out of range' )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Tuple    ,  a    :       int    ,  a    :       float )->     None:





     """simple docstring"""







     assert -len(self.__components ) <= pos < len(self.__components )
     lowercase__			    =						value


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[int] )->     float:





     """simple docstring"""







     if len(self.__components ) == 0:
       raise Exception('Vector is empty' )
     lowercase__			    =						[c**2 for c in self.__components]
     return math.sqrt(sum(a ) )


   def  SCREAMING_SNAKE_CASE_							(					self    :       str    ,  a    :       Vector    ,  a    :       bool = False )->     float:





     """simple docstring"""







     lowercase__			    =						self * other
     lowercase__			    =						self.euclidean_length() * other.euclidean_length()
     if deg:
       return math.degrees(math.acos(num / den ) )
     else:
       return math.acos(num / den )






def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	)       ->     Vector:
  assert isinstance(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)
  return Vector([0] * dimension	)




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     Vector:
  assert isinstance(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	) and (isinstance(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	))
  lowercase__			    =						[0] * dimension
  lowercase__			    =						1
  return Vector(_SCREAMING_SNAKE_CASE	)




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     Vector:
  assert (
      isinstance(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)
      and isinstance(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)
      and (isinstance(_SCREAMING_SNAKE_CASE	,		(int, float)	))
  )
  return x * scalar + y




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     Vector:
  random.seed(_SCREAMING_SNAKE_CASE	)
  lowercase__			    =						[random.randint(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	) for _ in range(_SCREAMING_SNAKE_CASE	)]
  return Vector(_SCREAMING_SNAKE_CASE	)
class        SCREAMING_SNAKE_CASE     :


   def __init__(					self    :       str    ,  a    :       list[list[float]]    ,  a    :       int    ,  a    :       int )->     None:





     """simple docstring"""







     lowercase__			    =						matrix
     lowercase__			    =						w
     lowercase__			    =						h


   def __str__(					self    :       List[Any] )->     str:





     """simple docstring"""







     lowercase__			    =						''
     for i in range(self.__height ):
       ans += "|"
       for j in range(self.__width ):
         if j < self.__width - 1:
           ans += str(self.__matrix[i][j] ) + ","
         else:
           ans += str(self.__matrix[i][j] ) + "|\n"
     return ans


   def __add__(					self    :       int    ,  a    :       Matrix )->     Matrix:





     """simple docstring"""







     if self.__width == other.width() and self.__height == other.height():
       lowercase__			    =						[]
       for i in range(self.__height ):
         lowercase__			    =						[
             self.__matrix[i][j] + other.component(a    ,  a )
             for j in range(self.__width )
         ]
         matrix.append(a )
       return Matrix(a    ,  self.__width    ,  self.__height )
     else:
       raise Exception('matrix must have the same dimension!' )


   def __sub__(					self    :       Optional[Any]    ,  a    :       Matrix )->     Matrix:





     """simple docstring"""







     if self.__width == other.width() and self.__height == other.height():
       lowercase__			    =						[]
       for i in range(self.__height ):
         lowercase__			    =						[
             self.__matrix[i][j] - other.component(a    ,  a )
             for j in range(self.__width )
         ]
         matrix.append(a )
       return Matrix(a    ,  self.__width    ,  self.__height )
     else:
       raise Exception('matrices must have the same dimension!' )


   @overload
   def __mul__(					self    :       Dict    ,  a    :       float )->     Matrix:





     """simple docstring"""







     ...


   @overload
   def __mul__(					self    :       str    ,  a    :       Vector )->     Vector:





     """simple docstring"""







     ...


   def __mul__(					self    :       int    ,  a    :       float | Vector )->     Vector | Matrix:





     """simple docstring"""







     if isinstance(a    ,  a ):  # matrix-vector
       if len(a ) == self.__width:
         lowercase__			    =						zero_vector(self.__height )
         for i in range(self.__height ):
           lowercase__			    =						[
               self.__matrix[i][j] * other.component(a )
               for j in range(self.__width )
           ]
           ans.change_component(a    ,  sum(a ) )
         return ans
       else:
         raise Exception(
             'vector must have the same size as the '
             'number of columns of the matrix!' )
     elif isinstance(a    ,  (int, float) ):  # matrix-scalar
       lowercase__			    =						[
           [self.__matrix[i][j] * other for j in range(self.__width )]
           for i in range(self.__height )
       ]
       return Matrix(a    ,  self.__width    ,  self.__height )
     return None


   def  SCREAMING_SNAKE_CASE_							(					self    :       Tuple )->     int:





     """simple docstring"""







     return self.__height


   def  SCREAMING_SNAKE_CASE_							(					self    :       int )->     int:





     """simple docstring"""







     return self.__width


   def  SCREAMING_SNAKE_CASE_							(					self    :       str    ,  a    :       int    ,  a    :       int )->     float:





     """simple docstring"""







     if 0 <= x < self.__height and 0 <= y < self.__width:
       return self.__matrix[x][y]
     else:
       raise Exception('change_component: indices out of bounds' )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[str]    ,  a    :       int    ,  a    :       int    ,  a    :       float )->     None:





     """simple docstring"""







     if 0 <= x < self.__height and 0 <= y < self.__width:
       lowercase__			    =						value
     else:
       raise Exception('change_component: indices out of bounds' )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Any    ,  a    :       int    ,  a    :       int )->     float:





     """simple docstring"""







     if self.__height != self.__width:
       raise Exception('Matrix is not square' )
     lowercase__			    =						self.__matrix[:x] + self.__matrix[x + 1 :]
     for i in range(len(a ) ):
       lowercase__			    =						minor[i][:y] + minor[i][y + 1 :]
     return Matrix(a    ,  self.__width - 1    ,  self.__height - 1 ).determinant()


   def  SCREAMING_SNAKE_CASE_							(					self    :       Dict    ,  a    :       int    ,  a    :       int )->     float:





     """simple docstring"""







     if self.__height != self.__width:
       raise Exception('Matrix is not square' )
     if 0 <= x < self.__height and 0 <= y < self.__width:
       return (-1) ** (x + y) * self.minor(a    ,  a )
     else:
       raise Exception('Indices out of bounds' )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[Any] )->     float:





     """simple docstring"""







     if self.__height != self.__width:
       raise Exception('Matrix is not square' )
     if self.__height < 1:
       raise Exception('Matrix has no element' )
     elif self.__height == 1:
       return self.__matrix[0][0]
     elif self.__height == 2:
       return (
           self.__matrix[0][0] * self.__matrix[1][1]
           - self.__matrix[0][1] * self.__matrix[1][0]
       )
     else:
       lowercase__			    =						[
           self.__matrix[0][y] * self.cofactor(0    ,  a ) for y in range(self.__width )
       ]
       return sum(a )






def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	)       ->     Matrix:
  lowercase__			    =						[[0] * n for _ in range(_SCREAMING_SNAKE_CASE	)]
  return Matrix(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     Matrix:
  random.seed(_SCREAMING_SNAKE_CASE	)
  lowercase__			    =						[
      [random.randint(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	) for _ in range(_SCREAMING_SNAKE_CASE	)] for _ in range(_SCREAMING_SNAKE_CASE	)
  ]
  return Matrix(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)









def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE = 50	)       ->     int:
  lowercase__			    =						[[0] * 3 for _ in range(length + 1	)]

  for row_length in range(length + 1	):
    for tile_length in range(2	,		5	):
      for tile_start in range(row_length - tile_length + 1	):
        different_colour_ways_number[row_length][tile_length - 2] += (
            different_colour_ways_number[row_length - tile_start - tile_length][
                tile_length - 2
            ]
            + 1
        )

  return sum(different_colour_ways_number[length]	)


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


