

"""simple docstring"""





def        _lowerCAmelCase      (						UpperCAmelCase     :							int				):


					'''simple docstring'''






					barcode //= 10  # exclude the last digit
					UpperCamelCase__		:    int         =False
					UpperCamelCase__		:    Union[str, Any]         =0

					# extract and check each digit
					while barcode != 0:
										UpperCamelCase__		:    List[Any]         =1 if checker else 3
										s += mult * (barcode % 10)
										barcode //= 10
										UpperCamelCase__		:    Union[str, Any]         =not checker

					return (10 - (s % 10)) % 10



def        _lowerCAmelCase      (						UpperCAmelCase     :							int				):


					'''simple docstring'''






					return len(str(UpperCAmelCase				)				) == 13 and get_check_digit(UpperCAmelCase				) == barcode % 10



def        _lowerCAmelCase      (						UpperCAmelCase     :							str				):


					'''simple docstring'''






					if str(UpperCAmelCase				).isalpha():
										UpperCamelCase__		:    Optional[Any]         =F'''Barcode \'{barcode}\' has alphabetic characters.'''
										raise ValueError(UpperCAmelCase				)
					elif int(UpperCAmelCase				) < 0:
										raise ValueError('''The entered barcode has a negative value. Try again.'''				)
					else:
										return int(UpperCAmelCase				)


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				_SCREAMING_SNAKE_CASE       :  str        = get_barcode(input("""Barcode: """).strip())

				if is_valid(barcode):
								print(F'''\'{barcode}\' is a valid barcode.''')
				else:
								print(F'''\'{barcode}\' is NOT a valid barcode.''')





"""simple docstring"""





def        _lowerCAmelCase      (						UpperCAmelCase     :							list[list[int]]				):


					'''simple docstring'''






					UpperCamelCase__		:    Dict         =[list(UpperCAmelCase				) for row in matrix]
					if matrix and isinstance(UpperCAmelCase      ,							UpperCAmelCase				):
										if isinstance(matrix[0]      ,							UpperCAmelCase				):
															UpperCamelCase__		:    List[Any]         =0
															for row in matrix:
																				if prev_len == 0:
																									UpperCamelCase__		:    Optional[Any]         =len(UpperCAmelCase				)
																									UpperCamelCase__		:    Optional[int]         =True
																				else:
																									UpperCamelCase__		:    List[str]         =prev_len == len(UpperCAmelCase				)
										else:
															UpperCamelCase__		:    Tuple         =True
					else:
										UpperCamelCase__		:    Optional[Any]         =False

					return result



def        _lowerCAmelCase      (						UpperCAmelCase     :							list[list[int]]				):


					'''simple docstring'''






					if check_matrix(UpperCAmelCase				) and len(UpperCAmelCase				) > 0:
										UpperCamelCase__		:    Optional[int]         =[list(UpperCAmelCase				) for row in a]
										UpperCamelCase__		:    Any         =len(UpperCAmelCase				)
										if isinstance(a[0]      ,							UpperCAmelCase				):
															UpperCamelCase__		:    Tuple         =len(a[0]				)
										else:
															for dat in a:
																				print(UpperCAmelCase				)
															return

										# horizotal printing increasing
										for i in range(0      ,							UpperCAmelCase				):
															print(a[0][i]				)
										# vertical printing down
										for i in range(1      ,							UpperCAmelCase				):
															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]				)
										UpperCamelCase__		:    Tuple         =[row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
										if len(UpperCAmelCase				) > 0:
															spiral_print_clockwise(UpperCAmelCase				)
										else:
															return
					else:
										print('''Not a valid matrix'''				)
										return



def        _lowerCAmelCase      (						UpperCAmelCase     :							list[list]				):


					'''simple docstring'''






					if matrix:
										return list(matrix.pop(0				)				) + spiral_traversal(list(zip(*UpperCAmelCase				)				)[::-1]				)
					else:
										return []


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

				doctest.testmod()

				_SCREAMING_SNAKE_CASE       :  int        = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 1_0, 1_1, 1_2]]
				spiral_print_clockwise(a)


