





def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			int:
     barcode //= 10  # exclude the last digit
     UpperCamelCase__    :     Optional[Any]        =						False
     UpperCamelCase__    :     List[Any]        =						0

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

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







def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			bool:
     return len(str(UpperCAmelCase_    )    ) == 13 and get_check_digit(UpperCAmelCase_    ) == barcode % 10







def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			int:






     if str(UpperCAmelCase_    ).isalpha():
          UpperCamelCase__    :     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()
 lowerCamelCase			:							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.""")







from __future__ import annotations







def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			list[int]:
     assert (
         isinstance(__lowerCAmelCase      ,					__lowerCAmelCase    ) and mask > 0
     ), f'mask needs to be positive integer, your input {mask}'
     UpperCamelCase__    :     Any        =						[]
     UpperCamelCase__    :     int        =						mask

     while submask:
          all_submasks.append(__lowerCAmelCase    )
          UpperCamelCase__    :     List[str]        =						(submask - 1) & mask

     return all_submasks


if __name__ == "__main__":
 import doctest

 doctest.testmod()