

def 		UpperCamelCase_(    snake_case__:						Optional[int]     ) ->				int:
 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 		UpperCamelCase_(    snake_case__:						Optional[Any]     ) ->				bool:
 return len(str(UpperCAmelCase_     )     ) == 13 and get_check_digit(UpperCAmelCase_     ) == barcode % 10
def 		UpperCamelCase_(    snake_case__:						Optional[int]     ) ->				int:






 if str(UpperCAmelCase_     ).isalpha():
  UpperCAmelCase__           =       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()
 _UpperCamelCase     =    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.""")








from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_UpperCamelCase     =    {
    '''configuration_fsmt''': ['''FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FSMTConfig'''],
    '''tokenization_fsmt''': ['''FSMTTokenizer'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _UpperCamelCase     =    ['''FSMTForConditionalGeneration''', '''FSMTModel''', '''PretrainedFSMTModel''']


if TYPE_CHECKING:
 from .configuration_fsmt import FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP, FSMTConfig
 from .tokenization_fsmt import FSMTTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_fsmt import FSMTForConditionalGeneration, FSMTModel, PretrainedFSMTModel

else:
 import sys

 _UpperCamelCase     =    _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



