"""simple docstring"""







def 					a__ (						UpperCAmelCase__    :     int     )->		int:
						barcode //= 1_0  # 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 % 1_0)
												barcode //= 1_0
												UpperCAmelCase__   		=						not checker

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


def 					a__ (						UpperCAmelCase__    :     int     )->		bool:
						return len(str(UpperCAmelCase__     )     ) == 1_3 and get_check_digit(UpperCAmelCase__     ) == barcode % 1_0


def 					a__ (						UpperCAmelCase__    :     str     )->		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_    :    str											=						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 __future__ import annotations


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

						while submask:
												all_submasks.append(UpperCAmelCase__     )
												UpperCAmelCase__   		=						(submask - 1) & mask

						return all_submasks


if __name__ == "__main__":
						import doctest

						doctest.testmod()

