



def    UpperCAmelCase					(  lowercase__						:					int	):



			'''simple docstring'''





			barcode //= 10  # exclude the last digit
			a__					=  False
			a__					=  0

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

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




def    UpperCAmelCase					(  lowercase__						:					int	):



			'''simple docstring'''





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




def    UpperCAmelCase					(  lowercase__						:					str	):



			'''simple docstring'''





			if str(lowercase__	).isalpha():
						a__					=  f'Barcode \'{barcode}\' has alphabetic characters.'
						raise ValueError(lowercase__	)
			elif int(lowercase__	) < 0:
						raise ValueError("""The entered barcode has a negative value. Try again."""	)
			else:
						return int(lowercase__	)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	_lowercase				:					Dict     					=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'''



import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
	from PIL import Image






class        UpperCAmelCase__						(		unittest.TestCase				,							UpperCamelCase__			):



					def 							UpperCAmelCase_			(     self  )  ->      Optional[int]:
						__lowerCAmelCase       				=	load_tool("image-question-answering"  )
						self.tool.setup()
						__lowerCAmelCase       				=	load_tool("image-question-answering"      ,					remote=UpperCamelCase  )



					def 							UpperCAmelCase_			(     self  )  ->      Optional[int]:
						__lowerCAmelCase       				=	Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"  )  ) / "000000039769.png"  )
						__lowerCAmelCase       				=	self.tool(UpperCamelCase      ,					"How many cats are sleeping on the couch?"  )
						self.assertEqual(UpperCamelCase      ,					"2"  )



					def 							UpperCAmelCase_			(     self  )  ->      Dict:
						__lowerCAmelCase       				=	Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"  )  ) / "000000039769.png"  )
						__lowerCAmelCase       				=	self.remote_tool(UpperCamelCase      ,					"How many cats are sleeping on the couch?"  )
						self.assertEqual(UpperCamelCase      ,					"2"  )



					def 							UpperCAmelCase_			(     self  )  ->      Optional[Any]:
						__lowerCAmelCase       				=	Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"  )  ) / "000000039769.png"  )
						__lowerCAmelCase       				=	self.tool(image=UpperCamelCase      ,					question="How many cats are sleeping on the couch?"  )
						self.assertEqual(UpperCamelCase      ,					"2"  )



					def 							UpperCAmelCase_			(     self  )  ->      Dict:
						__lowerCAmelCase       				=	Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"  )  ) / "000000039769.png"  )
						__lowerCAmelCase       				=	self.remote_tool(image=UpperCamelCase      ,					question="How many cats are sleeping on the couch?"  )
						self.assertEqual(UpperCamelCase      ,					"2"  )