



def  _lowerCAmelCase     (_lowerCAmelCase):
					barcode //= 10  # exclude the last digit
					UpperCamelCase_			= False
					UpperCamelCase_			= 0

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

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



def  _lowerCAmelCase     (_lowerCAmelCase):
					return len(str(_lowerCAmelCase)) == 13 and get_check_digit(_lowerCAmelCase) == barcode % 10



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


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	UpperCAmelCase :				int							=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 torch
from torch import autograd






class __a ( autograd.Function					):



  @staticmethod
  def     A_					(lowercase_	:		Optional[Any]					,      lowercase_	:		torch.tensor					,      lowercase_	:		float					,      lowercase_	:		bool )		->				List[str]:
   __A						:							str      =						inputs.numel()
   __A						:							str      =						int(0.005 * nb_elems ) + 1
   if sigmoid:
    __A						:							Dict      =						(torch.sigmoid(lowercase_ ) > threshold).type(inputs.type() )
   else:
    __A						:							Tuple      =						(inputs > threshold).type(inputs.type() )
   if mask.sum() < nb_min:
    # We limit the pruning so that at least 0.5% (half a percent) of the weights are remaining
    __A						:							Any      =						inputs.flatten().kthvalue(max(nb_elems - nb_min					,      1 ) ).values
    __A						:							Union[str, Any]      =						(inputs > k_threshold).type(inputs.type() )
   return mask



  @staticmethod
  def     A_					(lowercase_	:		str					,      lowercase_	:		Any )		->				int:
   return gradOutput, None, None






class __a ( autograd.Function					):



  @staticmethod
  def     A_					(lowercase_	:		List[Any]					,      lowercase_	:		torch.tensor					,      lowercase_	:		float )		->				Dict:
   __A						:							List[Any]      =						inputs.clone()
   __A     ,       __A						:							Optional[int]      =						inputs.flatten().sort(descending=lowercase_ )
   __A						:							Tuple      =						int(threshold * inputs.numel() )

   # flat_out and mask access the same memory.
   __A						:							Optional[Any]      =						mask.flatten()
   __A						:							Dict      =						0
   __A						:							Any      =						1
   return mask



  @staticmethod
  def     A_					(lowercase_	:		Tuple					,      lowercase_	:		Optional[Any] )		->				str:
   return gradOutput, None






class __a ( snake_case_					):



  @staticmethod
  def     A_					(lowercase_	:		torch.tensor					,      lowercase_	:		float )		->				List[str]:
   __A						:							List[str]      =						inputs.clone()
   __A     ,       __A						:							List[Any]      =						inputs.abs().flatten().sort(descending=lowercase_ )
   __A						:							Dict      =						int(threshold * inputs.numel() )

   # flat_out and mask access the same memory.
   __A						:							List[Any]      =						mask.flatten()
   __A						:							Dict      =						0
   __A						:							Tuple      =						1
   return mask





