
from __future__ import annotations

from typing import Any


class 							lowercase   :



		def __init__(					self							, A_							, A_			)    ->   None:  # noqa: A002
				"""simple docstring"""
				UpperCamelCase            =	item
				UpperCamelCase            =	next






class 							lowercase   :



		def __init__(					self			)    ->   None:
				"""simple docstring"""
				UpperCamelCase            =	None
				UpperCamelCase            =	0



		def __UpperCamelCase					(					self							, A_			)    ->   None:
				"""simple docstring"""
				UpperCamelCase            =	Node(A_							, self.head			)
				self.size += 1



		def __UpperCamelCase					(					self			)    ->   Any:
				"""simple docstring"""
				# Switched 'self.is_empty()' to 'self.head is None'
				# because mypy was considering the possibility that 'self.head'
				# can be None in below else part and giving error
				if self.head is None:
						return None
				else:
						UpperCamelCase            =	self.head.item
						UpperCamelCase            =	self.head.next
						self.size -= 1
						return item



		def __UpperCamelCase					(					self			)    ->   bool:
				"""simple docstring"""
				return self.head is None



		def __str__(					self			)    ->   str:
				"""simple docstring"""
				if self.is_empty():
						return ""
				else:
						UpperCamelCase            =	self.head
						UpperCamelCase            =	''
						UpperCamelCase            =	[]
						while iterate:
								item_list.append(str(iterate.item			)			)
								UpperCamelCase            =	iterate.next

						UpperCamelCase            =	' --> '.join(A_			)

						return item_str



		def __len__(					self			)    ->   int:
				"""simple docstring"""
				return self.size


def  A			(   lowercase					)  ->    int:
		'''simple docstring'''

		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  A			(   lowercase					)  ->    bool:
		'''simple docstring'''

		return len(str(lowercase					)					) == 13 and get_check_digit(lowercase					) == barcode % 10


def  A			(   lowercase					)  ->    int:
		'''simple docstring'''

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


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					_UpperCAmelCase   :					List[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.''')
