





"""simple docstring"""


def 				a__      (	_UpperCAmelCase						)     ->	int:

 '''simple docstring'''






 barcode //= 1_0  # exclude the last digit
 snake_case__     				=					False
 snake_case__     				=					0

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

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





def 				a__      (	_UpperCAmelCase						)     ->	bool:

 '''simple docstring'''






 return len(str(snake_case__						)						) == 1_3 and get_check_digit(snake_case__						) == barcode % 1_0





def 				a__      (	_UpperCAmelCase						)     ->	int:

 '''simple docstring'''






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


if __name__ == "__main__":
   import doctest

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









import math
from timeit import timeit

def 			__lowerCamelCase     (						snake_case__						)				->    int:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE       =    0
						_SCREAMING_SNAKE_CASE       =    abs(snake_case__						)
						while True:
												_SCREAMING_SNAKE_CASE       =    n // 10
												digits += 1
												if n == 0:
																		break
						return digits

def 			__lowerCamelCase     (						snake_case__						)				->    int:






						"""simple docstring"""





						return 1 if n == 0 else math.floor(math.log(abs(snake_case__						)			,10						) + 1						)

def 			__lowerCamelCase     (						snake_case__						)				->    int:






						"""simple docstring"""





						return len(str(abs(snake_case__						)						)						)

def 			__lowerCamelCase     (						)				->    None:






						"""simple docstring"""





						from collections.abc import Callable

						def benchmark_a_function(snake_case__			,snake_case__						) -> None:
												_SCREAMING_SNAKE_CASE       =    F'{func.__name__}({value})'
												_SCREAMING_SNAKE_CASE       =    timeit(F'__main__.{call}'			,setup="""import __main__"""						)
												print(F'{call}: {func(snake_case__						)} -- {timing} seconds'						)

						for value in (26_21_44, 11_25_89_99_06_84_26_24, 1_26_76_50_60_02_28_22_94_01_49_67_03_20_53_76):
												for func in (num_digits, num_digits_fast, num_digits_faster):
																		benchmark_a_function(snake_case__			,snake_case__						)
												print()


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		benchmark()

