

def     __magic_name__       ( A							)			->		int:
	barcode //= 1_0  # exclude the last digit
	snake_case							 =				False
	snake_case							 =				0

	# extract and check each digit
	while barcode != 0:
		snake_case							 =				1 if checker else 3
		s += mult * (barcode % 1_0)
		barcode //= 1_0
		snake_case							 =				not checker

	return (1_0 - (s % 1_0)) % 1_0

def     __magic_name__       ( A							)			->		bool:
	return len(str(A							)							) == 1_3 and get_check_digit(A							) == barcode % 1_0

def     __magic_name__       ( A							)			->		int:
	if str(A							).isalpha():
		snake_case							 =				F'''Barcode \'{barcode}\' has alphabetic characters.'''
		raise ValueError(A							)
	elif int(A							) < 0:
		raise ValueError('The entered barcode has a negative value. Try again.'							)
	else:
		return int(A							)


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						lowerCAmelCase_						   =			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'''

from cva import destroyAllWindows, imread, imshow, waitKey

def     __magic_name__       ( A					,   A							)			->		Union[str, Any]:
	snake_case , snake_case							 =				img.shape[0], img.shape[1]

	def to_grayscale(A					,   A					,   A							):
		return 0.2_126 * red + 0.587 * green + 0.114 * blue

	def normalize(A							):
		return min(A					,   2_5_5							)

	for i in range(A							):
		for j in range(A							):
			snake_case							 =				int(to_grayscale(*img[i][j]							)							)
			snake_case							 =				[
			    normalize(A							),
			    normalize(greyscale + factor							),
			    normalize(greyscale + 2 * factor							),
			]

	return img


if __name__ == "__main__":
						# read original image
						lowerCAmelCase_						   =			{
						    percentage: imread("image_data/lena.jpg", 1) for percentage in (1_0, 2_0, 3_0, 4_0)
						}

						for percentage, img in images.items():
												make_sepia(img, percentage)

						for percentage, img in images.items():
												imshow(f"Original image with sepia (factor: {percentage})", img)

						waitKey(0)
						destroyAllWindows()





