





import multiprocessing
from typing import TYPE_CHECKING, Optional, Union

from .. import Dataset, Features, config
from ..formatting import query_table
from ..packaged_modules.sql.sql import Sql
from ..utils import logging
from .abc import AbstractDatasetInputStream


if TYPE_CHECKING:
  import sqlitea

  import sqlalchemy



class 					__snake_case	(  __SCREAMING_SNAKE_CASE    ):


    '''simple docstring'''







    def __init__(       self   ,				A_   ,				A_   ,				A_ = None   ,				A_ = None   ,				A_ = False   ,				**A_   ,				):





        '''simple docstring'''

        super().__init__(features=A_   ,				cache_dir=A_   ,				keep_in_memory=A_   ,				**A_     )
        SCREAMING_SNAKE_CASE__											=			Sql(
            cache_dir=A_   ,				features=A_   ,				sql=A_   ,				con=A_   ,				**A_   ,				)




    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			None
        SCREAMING_SNAKE_CASE__											=			None
        SCREAMING_SNAKE_CASE__											=			None
        SCREAMING_SNAKE_CASE__											=			None

        self.builder.download_and_prepare(
            download_config=A_   ,				download_mode=A_   ,				verification_mode=A_   ,				base_path=A_   ,				)

        # Build dataset for splits
        SCREAMING_SNAKE_CASE__											=			self.builder.as_dataset(
            split='''train'''   ,				verification_mode=A_   ,				in_memory=self.keep_in_memory     )
        return dataset





class 					__snake_case	:


    '''simple docstring'''







    def __init__(       self   ,				A_   ,				A_   ,				A_   ,				A_ = None   ,				A_ = None   ,				**A_   ,				):





        '''simple docstring'''

        if num_proc is not None and num_proc <= 0:
            raise ValueError(f'''num_proc {num_proc} must be an integer > 0.'''     )

        SCREAMING_SNAKE_CASE__											=			dataset
        SCREAMING_SNAKE_CASE__											=			name
        SCREAMING_SNAKE_CASE__											=			con
        SCREAMING_SNAKE_CASE__											=			batch_size if batch_size else config.DEFAULT_MAX_BATCH_SIZE
        SCREAMING_SNAKE_CASE__											=			num_proc
        SCREAMING_SNAKE_CASE__											=			to_sql_kwargs



    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			self.to_sql_kwargs.pop('''sql'''   ,				A_     )
        SCREAMING_SNAKE_CASE__											=			self.to_sql_kwargs.pop('''con'''   ,				A_     )
        SCREAMING_SNAKE_CASE__											=			self.to_sql_kwargs.pop('''index'''   ,				A_     )

        SCREAMING_SNAKE_CASE__											=			self._write(index=A_   ,				**self.to_sql_kwargs     )
        return written



    def  lowercase_					(       self   ,				A_     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__											=			args
        SCREAMING_SNAKE_CASE__											=			{**to_sql_kwargs, '''if_exists''': '''append'''} if offset > 0 else to_sql_kwargs
        SCREAMING_SNAKE_CASE__											=			query_table(
            table=self.dataset.data   ,				key=slice(A_   ,				offset + self.batch_size     )   ,				indices=self.dataset._indices   ,				)
        SCREAMING_SNAKE_CASE__											=			batch.to_pandas()
        SCREAMING_SNAKE_CASE__											=			df.to_sql(self.name   ,				self.con   ,				index=A_   ,				**A_     )
        return num_rows or len(A_     )




    def  lowercase_					(       self   ,				A_   ,				**A_     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			0

        if self.num_proc is None or self.num_proc == 1:
            for offset in logging.tqdm(
                range(0   ,				len(self.dataset     )   ,				self.batch_size     )   ,				unit='''ba'''   ,				disable=not logging.is_progress_bar_enabled()   ,				desc='''Creating SQL from Arrow format'''   ,				):
                written += self._batch_sql((offset, index, to_sql_kwargs)     )
        else:
            SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__											=			len(self.dataset     ), self.batch_size
            with multiprocessing.Pool(self.num_proc     ) as pool:
                for num_rows in logging.tqdm(
                    pool.imap(
                        self._batch_sql   ,				[(offset, index, to_sql_kwargs) for offset in range(0   ,				A_   ,				A_     )]   ,				)   ,				total=(num_rows // batch_size) + 1 if num_rows % batch_size else num_rows // batch_size   ,				unit='''ba'''   ,				disable=not logging.is_progress_bar_enabled()   ,				desc='''Creating SQL from Arrow format'''   ,				):
                    written += num_rows

        return written







def 							__snake_case							(    )				->						int:
    return 1


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else two_pence(x - 2	) + one_pence()


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else five_pence(x - 5	) + two_pence(lowerCAmelCase_	)


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else ten_pence(x - 1_0	) + five_pence(lowerCAmelCase_	)


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else twenty_pence(x - 2_0	) + ten_pence(lowerCAmelCase_	)


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else fifty_pence(x - 5_0	) + twenty_pence(lowerCAmelCase_	)


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else one_pound(x - 1_0_0	) + fifty_pence(lowerCAmelCase_	)


def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    return 0 if x < 0 else two_pound(x - 2_0_0	) + one_pound(lowerCAmelCase_	)


def 							__snake_case							(    lowerCAmelCase_ = 2_0_0	)				->						int:
    return two_pound(lowerCAmelCase_	)


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