




def      UpperCAmelCase  (						UpperCamelCase__						,			UpperCamelCase__   )     ->     Union[str, Any]:







				'''simple docstring'''


				__lowerCAmelCase					=  len(UpperCamelCase__   )
				# Create a stack and push index of fist element to it
				__lowerCAmelCase					=  []
				st.append(0   )

				# Span value of first element is always 1
				__lowerCAmelCase					=  1

				# Calculate span values for rest of the elements
				for i in range(1						,			UpperCamelCase__   ):
								# Pop elements from stack while stack is not
								# empty and top of stack is smaller than price[i]
								while len(UpperCamelCase__   ) > 0 and price[st[0]] <= price[i]:
												st.pop()

								# If stack becomes empty, then price[i] is greater
								# than all elements on left of it, i.e. price[0],
								# price[1], ..price[i-1]. Else the price[i]  is
								# greater than elements after top of stack
								__lowerCAmelCase					=  i + 1 if len(UpperCamelCase__   ) <= 0 else (i - st[0])

								# Push this element to stack
								st.append(UpperCamelCase__   )





def      UpperCAmelCase  (						UpperCamelCase__						,			UpperCamelCase__   )     ->     int:







				'''simple docstring'''


				for i in range(0						,			UpperCamelCase__   ):
								print(arr[i]						,			end=""" """   )


# Driver program to test above function
__A						:		Optional[Any]          =						[10, 4, 5, 90, 120, 80]
__A						:		Optional[int]          =						[0 for i in range(len(price) + 1)]

# Fill the span values in array S[]
calculation_span(price, S)
print_array(S, len(price))











def      UpperCAmelCase  (						UpperCamelCase__   )     ->     int:







				'''simple docstring'''


				barcode //= 10  # exclude the last digit
				__lowerCAmelCase					=  False
				__lowerCAmelCase					=  0

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

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





def      UpperCAmelCase  (						UpperCamelCase__   )     ->     bool:







				'''simple docstring'''


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





def      UpperCAmelCase  (						UpperCamelCase__   )     ->     int:







				'''simple docstring'''


				if str(UpperCamelCase__   ).isalpha():
								__lowerCAmelCase					=  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()
	__A						:		Tuple          =						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.""")





