





'''simple docstring'''

import shutil
import tempfile
import unittest

import pytest

from transformers import WhisperTokenizer, is_speech_available
from transformers.testing_utils import require_sentencepiece, require_torch, require_torchaudio

from .test_feature_extraction_whisper import floats_list


if is_speech_available():
			from transformers import WhisperFeatureExtractor, WhisperProcessor


lowerCAmelCase__      :   Optional[int]      	=			5_03_58
lowerCAmelCase__      :   Tuple      	=			5_03_62


@require_torch
@require_torchaudio
@require_sentencepiece
class      SCREAMING_SNAKE_CASE__      (   unittest.TestCase		):







					"""simple docstring"""






					def 		lowerCamelCase_   (   self       :      Optional[int]		):







							"""simple docstring"""
							__UpperCAmelCase	:							Dict     =     "openai/whisper-small.en"
							__UpperCAmelCase	:							List[Any]     =     tempfile.mkdtemp()
					def 		lowerCamelCase_   (   self       :      Tuple		,	**UpperCAmelCase_       :      Optional[int]		):







							"""simple docstring"""
							return WhisperTokenizer.from_pretrained(self.checkpoint		,	**UpperCAmelCase_		)
					def 		lowerCamelCase_   (   self       :      int		,	**UpperCAmelCase_       :      int		):







							"""simple docstring"""
							return WhisperFeatureExtractor.from_pretrained(self.checkpoint		,	**UpperCAmelCase_		)
					def 		lowerCamelCase_   (   self       :      Union[str, Any]		):







							"""simple docstring"""
							shutil.rmtree(self.tmpdirname		)
					def 		lowerCamelCase_   (   self       :      Dict		):







							"""simple docstring"""
							__UpperCAmelCase	:							Dict     =     self.get_tokenizer()
							__UpperCAmelCase	:							Optional[int]     =     self.get_feature_extractor()

							__UpperCAmelCase	:							List[Any]     =     WhisperProcessor(tokenizer=UpperCAmelCase_		,	feature_extractor=UpperCAmelCase_		)

							processor.save_pretrained(self.tmpdirname		)
							__UpperCAmelCase	:							str     =     WhisperProcessor.from_pretrained(self.tmpdirname		)

							self.assertEqual(processor.tokenizer.get_vocab()		,	tokenizer.get_vocab()		)
							self.assertIsInstance(processor.tokenizer		,	UpperCAmelCase_		)

							self.assertEqual(processor.feature_extractor.to_json_string()		,	feature_extractor.to_json_string()		)
							self.assertIsInstance(processor.feature_extractor		,	UpperCAmelCase_		)
					def 		lowerCamelCase_   (   self       :      Dict		):







							"""simple docstring"""
							__UpperCAmelCase	:							Optional[Any]     =     WhisperProcessor(tokenizer=self.get_tokenizer()		,	feature_extractor=self.get_feature_extractor()		)
							processor.save_pretrained(self.tmpdirname		)

							__UpperCAmelCase	:							List[Any]     =     self.get_tokenizer(bos_token="(BOS)"		,	eos_token="(EOS)"		)
							__UpperCAmelCase	:							int     =     self.get_feature_extractor(do_normalize=UpperCAmelCase_		,	padding_value=1.0		)

							__UpperCAmelCase	:							List[Any]     =     WhisperProcessor.from_pretrained(
							    self.tmpdirname		,	bos_token="(BOS)"		,	eos_token="(EOS)"		,	do_normalize=UpperCAmelCase_		,	padding_value=1.0		)

							self.assertEqual(processor.tokenizer.get_vocab()		,	tokenizer_add_kwargs.get_vocab()		)
							self.assertIsInstance(processor.tokenizer		,	UpperCAmelCase_		)

							self.assertEqual(processor.feature_extractor.to_json_string()		,	feature_extractor_add_kwargs.to_json_string()		)
							self.assertIsInstance(processor.feature_extractor		,	UpperCAmelCase_		)
					def 		lowerCamelCase_   (   self       :      Optional[Any]		):







							"""simple docstring"""
							__UpperCAmelCase	:							List[Any]     =     self.get_feature_extractor()
							__UpperCAmelCase	:							int     =     self.get_tokenizer()

							__UpperCAmelCase	:							Optional[Any]     =     WhisperProcessor(tokenizer=UpperCAmelCase_		,	feature_extractor=UpperCAmelCase_		)

							__UpperCAmelCase	:							Union[str, Any]     =     floats_list((3, 1_000)		)

							__UpperCAmelCase	:							int     =     feature_extractor(UpperCAmelCase_		,	return_tensors="np"		)
							__UpperCAmelCase	:							Optional[Any]     =     processor(UpperCAmelCase_		,	return_tensors="np"		)

							for key in input_feat_extract.keys():
									self.assertAlmostEqual(input_feat_extract[key].sum()		,	input_processor[key].sum()		,	delta=1e-2		)
					def 		lowerCamelCase_   (   self       :      int		):







							"""simple docstring"""
							__UpperCAmelCase	:							int     =     self.get_feature_extractor()
							__UpperCAmelCase	:							List[str]     =     self.get_tokenizer()

							__UpperCAmelCase	:							str     =     WhisperProcessor(tokenizer=UpperCAmelCase_		,	feature_extractor=UpperCAmelCase_		)

							__UpperCAmelCase	:							str     =     "This is a test string"

							__UpperCAmelCase	:							Optional[int]     =     processor(text=UpperCAmelCase_		)

							__UpperCAmelCase	:							Optional[int]     =     tokenizer(UpperCAmelCase_		)

							for key in encoded_tok.keys():
									self.assertListEqual(encoded_tok[key]		,	encoded_processor[key]		)
					def 		lowerCamelCase_   (   self       :      Union[str, Any]		):







							"""simple docstring"""
							__UpperCAmelCase	:							int     =     self.get_feature_extractor()
							__UpperCAmelCase	:							Optional[int]     =     self.get_tokenizer()

							__UpperCAmelCase	:							List[Any]     =     WhisperProcessor(tokenizer=UpperCAmelCase_		,	feature_extractor=UpperCAmelCase_		)

							__UpperCAmelCase	:							Dict     =     [[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]

							__UpperCAmelCase	:							str     =     processor.batch_decode(UpperCAmelCase_		)
							__UpperCAmelCase	:							Dict     =     tokenizer.batch_decode(UpperCAmelCase_		)

							self.assertListEqual(UpperCAmelCase_		,	UpperCAmelCase_		)
					def 		lowerCamelCase_   (   self       :      int		):







							"""simple docstring"""
							__UpperCAmelCase	:							Tuple     =     self.get_feature_extractor()
							__UpperCAmelCase	:							Any     =     self.get_tokenizer()

							__UpperCAmelCase	:							Union[str, Any]     =     WhisperProcessor(tokenizer=UpperCAmelCase_		,	feature_extractor=UpperCAmelCase_		)

							self.assertListEqual(
							    processor.model_input_names		,	feature_extractor.model_input_names		,	msg="`processor` and `feature_extractor` model input names do not match"		,	)
					def 		lowerCamelCase_   (   self       :      Dict		):







							"""simple docstring"""
							__UpperCAmelCase	:							Optional[int]     =     self.get_feature_extractor()
							__UpperCAmelCase	:							List[Any]     =     self.get_tokenizer()

							__UpperCAmelCase	:							Union[str, Any]     =     WhisperProcessor(tokenizer=UpperCAmelCase_		,	feature_extractor=UpperCAmelCase_		)
							__UpperCAmelCase	:							str     =     processor.get_decoder_prompt_ids(task="transcribe"		,	no_timestamps=UpperCAmelCase_		)

							self.assertIsInstance(UpperCAmelCase_		,	UpperCAmelCase_		)
							for ids in forced_decoder_ids:
									self.assertIsInstance(UpperCAmelCase_		,	(list, tuple)		)

							__UpperCAmelCase	:							str     =     [TRANSCRIBE, NOTIMESTAMPS]
							self.assertListEqual([ids[-1] for ids in forced_decoder_ids]		,	UpperCAmelCase_		)
					def 		lowerCamelCase_   (   self       :      int		):







							"""simple docstring"""
							__UpperCAmelCase	:							Optional[Any]     =     WhisperProcessor(tokenizer=self.get_tokenizer()		,	feature_extractor=self.get_feature_extractor()		)
							__UpperCAmelCase	:							Dict     =     processor.get_prompt_ids("Mr. Quilter"		)
							__UpperCAmelCase	:							Optional[int]     =     processor.tokenizer.decode(UpperCAmelCase_		)

							self.assertListEqual(prompt_ids.tolist()		,	[50_360, 1_770, 13, 2_264, 346, 353]		)
							self.assertEqual(UpperCAmelCase_		,	"<|startofprev|> Mr. Quilter"		)
					def 		lowerCamelCase_   (   self       :      List[Any]		):







							"""simple docstring"""
							__UpperCAmelCase	:							Optional[Any]     =     WhisperProcessor(tokenizer=self.get_tokenizer()		,	feature_extractor=self.get_feature_extractor()		)
							__UpperCAmelCase	:							Any     =     processor.get_prompt_ids(""		)
							__UpperCAmelCase	:							Any     =     processor.tokenizer.decode(UpperCAmelCase_		)

							self.assertListEqual(prompt_ids.tolist()		,	[50_360, 220]		)
							self.assertEqual(UpperCAmelCase_		,	"<|startofprev|> "		)






					def 		lowerCamelCase_   (   self       :      List[str]		):







							"""simple docstring"""
							__UpperCAmelCase	:							Any     =     WhisperProcessor(tokenizer=self.get_tokenizer()		,	feature_extractor=self.get_feature_extractor()		)

							def _test_prompt_error_raised_helper(UpperCAmelCase_       :      Optional[int]		,	UpperCAmelCase_       :      Tuple		):
									with pytest.raises(UpperCAmelCase_		) as excinfo:
											processor.get_prompt_ids(UpperCAmelCase_		)
									__UpperCAmelCase	:							int     =     f"Encountered text in the prompt corresponding to disallowed special token: {special_token}."
									self.assertEqual(UpperCAmelCase_		,	str(excinfo.value		)		)

							_test_prompt_error_raised_helper("<|startofprev|> test"		,	"<|startofprev|>"		)
							_test_prompt_error_raised_helper("test <|notimestamps|>"		,	"<|notimestamps|>"		)
							_test_prompt_error_raised_helper("test <|zh|> test <|transcribe|>"		,	"<|zh|>"		)











'''simple docstring'''

from __future__ import annotations

lowerCAmelCase__      :   Tuple      	=			{1: 1}


def 						__UpperCamelCase						(			_UpperCAmelCase  ):
		if n in COLLATZ_SEQUENCE_LENGTHS:
				return COLLATZ_SEQUENCE_LENGTHS[n]
		__UpperCAmelCase	:							int     =     n // 2 if n % 2 == 0 else 3 * n + 1
		__UpperCAmelCase	:							str     =     collatz_sequence_length(_UpperCAmelCase  ) + 1
		__UpperCAmelCase	:							Union[str, Any]     =     sequence_length
		return sequence_length


def 						__UpperCamelCase						(			_UpperCAmelCase = 1000000  ):
		__UpperCAmelCase	:							Union[str, Any]     =     max((collatz_sequence_length(_UpperCAmelCase  ), i) for i in range(1,       _UpperCAmelCase  )  )
		return result[1]


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




