

"""simple docstring"""


def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			bool:
		# must be
		__lowerCAmelCase: List[str]					   =    [list(__SCREAMING_SNAKE_CASE				) for row in matrix]
		if matrix and isinstance(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				):
				if isinstance(matrix[0]      ,				__SCREAMING_SNAKE_CASE				):
						__lowerCAmelCase: Tuple					   =    0
						for row in matrix:
								if prev_len == 0:
										__lowerCAmelCase: Optional[Any]					   =    len(__SCREAMING_SNAKE_CASE				)
										__lowerCAmelCase: Any					   =    True
								else:
										__lowerCAmelCase: Optional[Any]					   =    prev_len == len(__SCREAMING_SNAKE_CASE				)
				else:
						__lowerCAmelCase: Optional[int]					   =    True
		else:
				__lowerCAmelCase: List[str]					   =    False

		return result






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			None:
		if check_matrix(__SCREAMING_SNAKE_CASE				) and len(__SCREAMING_SNAKE_CASE				) > 0:
				__lowerCAmelCase: Tuple					   =    [list(__SCREAMING_SNAKE_CASE				) for row in a]
				__lowerCAmelCase: Optional[Any]					   =    len(__SCREAMING_SNAKE_CASE				)
				if isinstance(a[0]      ,				__SCREAMING_SNAKE_CASE				):
						__lowerCAmelCase: Dict					   =    len(a[0]				)
				else:
						for dat in a:
								print(__SCREAMING_SNAKE_CASE				)
						return

				# horizotal printing increasing
				for i in range(0      ,				__SCREAMING_SNAKE_CASE				):
						print(a[0][i]				)
				# vertical printing down
				for i in range(1      ,				__SCREAMING_SNAKE_CASE				):
						print(a[i][mat_col - 1]				)
				# horizotal printing decreasing
				if mat_row > 1:
						for i in range(mat_col - 2      ,				-1      ,				-1				):
								print(a[mat_row - 1][i]				)
        # vertical printing up
				for i in range(mat_row - 2      ,				0      ,				-1				):
						print(a[i][0]				)
				__lowerCAmelCase: Optional[int]					   =    [row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
				if len(__SCREAMING_SNAKE_CASE				) > 0:
						spiral_print_clockwise(__SCREAMING_SNAKE_CASE				)
				else:
						return
		else:
				print("Not a valid matrix"				)
				return






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			list[int]:
		if matrix:
				return list(matrix.pop(0				)				) + spiral_traversal(list(zip(*__SCREAMING_SNAKE_CASE				)				)[::-1]				)
		else:
				return []


# driver code
if __name__ == "__main__":
			import doctest

			doctest.testmod()

			__A		     =    [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
			spiral_print_clockwise(a)





"""simple docstring"""


def 					a__					(					__SCREAMING_SNAKE_CASE = 1_0_0_0				)			->			int:
		__lowerCAmelCase: int					   =    0
		__lowerCAmelCase: Optional[int]					   =    0
		while 1:
				num += 3
				if num >= n:
						break
				total += num
				num += 2
				if num >= n:
						break
				total += num
				num += 1
				if num >= n:
						break
				total += num
				num += 3
				if num >= n:
						break
				total += num
				num += 1
				if num >= n:
						break
				total += num
				num += 2
				if num >= n:
						break
				total += num
				num += 3
				if num >= n:
						break
				total += num
		return total


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


