




import os
from collections import deque

import torch
from torch.utils.data import Dataset
class 						UpperCAmelCase  (							UpperCAmelCase__     ):







						'''simple docstring'''





						def __init__(		self				:	Any			,      __lowercase				:	Any=""			,      __lowercase				:	str="train"		):






							"""simple docstring"""






							assert os.path.isdir(__lowercase		)

							snake_case_						       =	[]
							snake_case_						       =	os.listdir(__lowercase		)
							for story_filename in story_filenames_list:
								if "summary" in story_filename:
									continue
								snake_case_						       =	os.path.join(__lowercase			,      __lowercase		)
								if not os.path.isfile(__lowercase		):
									continue
								self.documents.append(__lowercase		)






						def __len__(		self				:	str		):






							"""simple docstring"""






							return len(self.documents		)






						def __getitem__(		self				:	Union[str, Any]			,      __lowercase				:	Optional[int]		):






							"""simple docstring"""






							snake_case_						       =	self.documents[idx]
							snake_case_						       =	document_path.split("/"		)[-1]
							with open(__lowercase			,      encoding="utf-8"		) as source:
								snake_case_						       =	source.read()
								snake_case_       , snake_case_						       =	process_story(__lowercase		)
							return document_name, story_lines, summary_lines







def 		lowerCamelCase__       (						_A				):







	'''simple docstring'''





	snake_case_						       =	list(filter(lambda _A				: len(_A				) != 0	,      [line.strip() for line in raw_story.split("\n"				)]				)				)

	# for some unknown reason some lines miss a period, add it
	snake_case_						       =	[_add_missing_period(_A				) for line in nonempty_lines]

	# gather article lines
	snake_case_						       =	[]
	snake_case_						       =	deque(_A				)
	while True:
		try:
			snake_case_						       =	lines.popleft()
			if element.startswith("@highlight"				):
				break
			story_lines.append(_A				)
		except IndexError:
			# if "@highlight" is absent from the file we pop
			# all elements until there is None, raising an exception.
			return story_lines, []

    # gather summary lines
	snake_case_						       =	list(filter(lambda _A				: not t.startswith("@highlight"				)	,      _A				)				)

	return story_lines, summary_lines


def 		lowerCamelCase__       (						_A				):







	'''simple docstring'''





	snake_case_						       =	[".", "!", "?", "...", "'", "`", "\"", "\u2019", "\u2019", ")"]
	if line.startswith("@highlight"				):
		return line
	if line[-1] in END_TOKENS:
		return line
	return line + "."


def 		lowerCamelCase__       (						_A	,      _A	,      _A				):







	'''simple docstring'''





	if len(_A				) > block_size:
		return sequence[:block_size]
	else:
		sequence.extend([pad_token_id] * (block_size - len(_A				))				)
		return sequence


def 		lowerCamelCase__       (						_A	,      _A				):







	'''simple docstring'''





	snake_case_						       =	torch.ones_like(_A				)
	snake_case_						       =	sequence == pad_token_id
	snake_case_						       =	0
	return mask


def 		lowerCamelCase__       (						_A	,      _A	,      _A				):







	'''simple docstring'''





	snake_case_						       =	[tokenizer.encode(_A				) for line in story_lines]
	snake_case_						       =	[token for sentence in story_lines_token_ids for token in sentence]
	snake_case_						       =	[tokenizer.encode(_A				) for line in summary_lines]
	snake_case_						       =	[token for sentence in summary_lines_token_ids for token in sentence]

	return story_token_ids, summary_token_ids






def 		lowerCamelCase__       (						_A	,      _A				):







	'''simple docstring'''





	snake_case_						       =	[]
	for sequence in batch:
		snake_case_						       =	-1
		snake_case_						       =	[]
		for s in sequence:
			if s == separator_token_id:
				sentence_num += 1
			embeddings.append(sentence_num % 2				)
		batch_embeddings.append(_A				)
	return torch.tensor(_A				)






def 		lowerCamelCase__       (						_A				):







	'''simple docstring'''





	snake_case_						       =	1
	for i in range(1	,      num + 1				):
		fact *= i
	return fact


def 		lowerCamelCase__       (						_A				):







	'''simple docstring'''





	snake_case_						       =	0
	while number > 0:
		snake_case_						       =	number % 10
		sum_of_digits += last_digit
		snake_case_						       =	number // 10  # Removing the last_digit from the given number
	return sum_of_digits


def 		lowerCamelCase__       (						_A = 100				):







	'''simple docstring'''





	snake_case_						       =	factorial(_A				)
	snake_case_						       =	split_and_add(_A				)
	return result


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