

lowerCAmelCase_       	=	2_56
# Modulus to hash a string
lowerCAmelCase_       	=	1_00_00_03


def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       ):
						snake_case_   =	len(SCREAMING_SNAKE_CASE__       )
						snake_case_   =	len(SCREAMING_SNAKE_CASE__       )
						if p_len > t_len:
												return False

						snake_case_   =	0
						snake_case_   =	0
						snake_case_   =	1

						# Calculating the hash of pattern and substring of text
						for i in range(SCREAMING_SNAKE_CASE__       ):
												snake_case_   =	(ord(pattern[i]       ) + p_hash * alphabet_size) % modulus
												snake_case_   =	(ord(text[i]       ) + text_hash * alphabet_size) % modulus
												if i == p_len - 1:
																		continue
												snake_case_   =	(modulus_power * alphabet_size) % modulus

						for i in range(0  ,		t_len - p_len + 1       ):
												if text_hash == p_hash and text[i : i + p_len] == pattern:
																		return True
												if i == t_len - p_len:
																		continue
												# Calculate the https://en.wikipedia.org/wiki/Rolling_hash
												snake_case_   =	(
												    (text_hash - ord(text[i]       ) * modulus_power) * alphabet_size
												    + ord(text[i + p_len]       )
												) % modulus
						return False


def   __SCREAMING_SNAKE_CASE					():
						snake_case_   =	'''abc1abc12'''
						snake_case_   =	'''alskfjaldsabc1abc1abc12k23adsfabcabc'''
						snake_case_   =	'''alskfjaldsk23adsfabcabc'''
						assert rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       ) and not rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )

						# Test 2)
						snake_case_   =	'''ABABX'''
						snake_case_   =	'''ABABZABABYABABX'''
						assert rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )

						# Test 3)
						snake_case_   =	'''AAAB'''
						snake_case_   =	'''ABAAAAAB'''
						assert rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )

						# Test 4)
						snake_case_   =	'''abcdabcy'''
						snake_case_   =	'''abcxabcdabxabcdabcdabcy'''
						assert rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )

						# Test 5)
						snake_case_   =	'''Lü'''
						snake_case_   =	'''Lüsai'''
						assert rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )
						snake_case_   =	'''Lue'''
						assert not rabin_karp(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )
						print('''Success.'''       )


if __name__ == "__main__":
					test_rabin_karp()





def 		__A		(	__lowerCamelCase    )      ->       int:
	a										=							hex_num.strip()
	if not hex_num:
		raise ValueError("""No value was passed to the function"""    )

	a										=							hex_num[0] == """-"""
	if is_negative:
		a										=							hex_num[1:]

	try:
		a										=							int(__lowerCamelCase							,			16    )
	except ValueError:
		raise ValueError("""Invalid value was passed to the function"""    )

	a										=							""""""
	while int_num > 0:
		a										=							str(int_num % 2    ) + bin_str
		int_num >>= 1

	return int(("""-""" + bin_str) if is_negative else bin_str    )


if __name__ == "__main__":
		import doctest

		doctest.testmod()

