



'''simple docstring'''

import unittest

from datasets import load_dataset

from transformers import BloomTokenizerFast
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin

@require_tokenizers
class __snake_case(				_UpperCAmelCase		,							unittest.TestCase ):


	'''simple docstring'''



	UpperCAmelCase							:   Dict									=		None
	UpperCAmelCase							:   str									=		BloomTokenizerFast
	UpperCAmelCase							:   Union[str, Any]									=		BloomTokenizerFast
	UpperCAmelCase							:   Optional[Any]									=		True
	UpperCAmelCase							:   Optional[Any]									=		False
	UpperCAmelCase							:   int									=		"tokenizer_file"
	UpperCAmelCase							:   Optional[Any]									=		{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>"}


	def     __snake_case   ( self				)     ->     Union[str, Any]:
		super().setUp()
		lowerCAmelCase   =     BloomTokenizerFast.from_pretrained("""bigscience/tokenizer"""				)
		tokenizer.save_pretrained(self.tmpdirname				)


	def     __snake_case   ( self     ,	**A_				)     ->     Union[str, Any]:
		kwargs.update(self.special_tokens_map				)
		return BloomTokenizerFast.from_pretrained(self.tmpdirname     ,	**lowercase_				)


	def     __snake_case   ( self				)     ->     str:
		lowerCAmelCase   =     self.get_rust_tokenizer()

		lowerCAmelCase   =     ["""The quick brown fox</s>""", """jumps over the lazy dog</s>"""]
		lowerCAmelCase   =     [[2175, 2_3714, 7_3173, 14_4252, 2], [77, 13_2619, 3478, 368, 10_9586, 3_5433, 2]]

		lowerCAmelCase   =     tokenizer.batch_encode_plus(lowercase_				)["""input_ids"""]
		self.assertListEqual(lowercase_     ,	lowercase_				)

		lowerCAmelCase   =     tokenizer.batch_decode(lowercase_				)
		self.assertListEqual(lowercase_     ,	lowercase_				)


	def     __snake_case   ( self     ,	A_=6				)     ->     Dict:
		for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
			with self.subTest(f'{tokenizer.__class__.__name__} ({pretrained_name})'				):
				lowerCAmelCase   =     self.rust_tokenizer_class.from_pretrained(lowercase_     ,	**lowercase_				)
				# tokenizer_r.pad_token = None # Hotfixing padding = None
				# Simple input
				lowerCAmelCase   =     """This is a simple input"""
				lowerCAmelCase   =     ["""This is a simple input 1""", """This is a simple input 2"""]
				lowerCAmelCase   =     ("""This is a simple input""", """This is a pair""")
				lowerCAmelCase   =     [
				    ("""This is a simple input 1""", """This is a simple input 2"""),
				    ("""This is a simple pair 1""", """This is a simple pair 2"""),
				]

				# Simple input tests
				try:
					tokenizer_r.encode(lowercase_     ,	max_length=lowercase_				)
					tokenizer_r.encode_plus(lowercase_     ,	max_length=lowercase_				)

					tokenizer_r.batch_encode_plus(lowercase_     ,	max_length=lowercase_				)
					tokenizer_r.encode(lowercase_     ,	max_length=lowercase_				)
					tokenizer_r.batch_encode_plus(lowercase_     ,	max_length=lowercase_				)
				except ValueError:
					self.fail("""Bloom Tokenizer should be able to deal with padding"""				)

				lowerCAmelCase   =     None  # Hotfixing padding = None
				self.assertRaises(lowercase_     ,	tokenizer_r.encode     ,	lowercase_     ,	max_length=lowercase_     ,	padding="""max_length"""				)

				# Simple input
				self.assertRaises(lowercase_     ,	tokenizer_r.encode_plus     ,	lowercase_     ,	max_length=lowercase_     ,	padding="""max_length"""				)

				# Simple input
				self.assertRaises(
				    lowercase_     ,	tokenizer_r.batch_encode_plus     ,	lowercase_     ,	max_length=lowercase_     ,	padding="""max_length"""     ,	)

				# Pair input
				self.assertRaises(lowercase_     ,	tokenizer_r.encode     ,	lowercase_     ,	max_length=lowercase_     ,	padding="""max_length"""				)

				# Pair input
				self.assertRaises(lowercase_     ,	tokenizer_r.encode_plus     ,	lowercase_     ,	max_length=lowercase_     ,	padding="""max_length"""				)

				# Pair input
				self.assertRaises(
				    lowercase_     ,	tokenizer_r.batch_encode_plus     ,	lowercase_     ,	max_length=lowercase_     ,	padding="""max_length"""     ,	)


	def     __snake_case   ( self				)     ->     Dict:
		lowerCAmelCase   =     self.get_rust_tokenizer()
		lowerCAmelCase   =     load_dataset("""xnli"""     ,	"""all_languages"""     ,	split="""test"""     ,	streaming=lowercase_				)

		lowerCAmelCase   =     next(iter(lowercase_				)				)["""premise"""]  # pick up one data
		lowerCAmelCase   =     list(sample_data.values()				)

		lowerCAmelCase   =     list(map(tokenizer.encode     ,	lowercase_				)				)
		lowerCAmelCase   =     [tokenizer.decode(lowercase_     ,	clean_up_tokenization_spaces=lowercase_				) for x in output_tokens]
		self.assertListEqual(lowercase_     ,	lowercase_				)




	def     __snake_case   ( self				)     ->     Union[str, Any]:
		# The test has to be overriden because BLOOM uses ALiBi positional embeddings that does not have
		# any sequence length constraints. This test of the parent class will fail since it relies on the
		# maximum sequence length of the positoonal embeddings.
		self.assertGreaterEqual(len(self.tokenizer_class.pretrained_vocab_files_map				)     ,	1				)
		self.assertGreaterEqual(len(list(self.tokenizer_class.pretrained_vocab_files_map.values()				)[0]				)     ,	1				)




'''simple docstring'''

from __future__ import annotations






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int | str							)      ->						bool:







	"""simple docstring"""
	lowerCAmelCase   =     str(_SCREAMING_SNAKE_CASE							)
	return n == n[::-1]






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int = 1_000_000							)      ->						Dict:







	"""simple docstring"""
	lowerCAmelCase   =     0

	for i in range(1							,		_SCREAMING_SNAKE_CASE							):
		if is_palindrome(_SCREAMING_SNAKE_CASE							) and is_palindrome(bin(_SCREAMING_SNAKE_CASE							).split("""b"""							)[1]							):
			total += i
	return total


if __name__ == "__main__":
				print(solution(int(str(input().strip()))))