




'''simple docstring'''

from __future__ import annotations



def 							UpperCamelCase__			(			a__      ):


						'''simple docstring'''






						_lowerCAmelCase										=str(_lowerCAmelCase      )
						return len(_lowerCAmelCase      ) == 9 and set(_lowerCAmelCase      ) == set('123456789'      )



def 							UpperCamelCase__			(			):


						'''simple docstring'''






						for base_num in range(9_9_9_9			,      4_9_9_9			,      -1      ):
												_lowerCAmelCase										=1_0_0_0_0_2 * base_num
												if is_9_pandigital(_lowerCAmelCase      ):
																		return candidate

						for base_num in range(3_3_3			,      9_9			,      -1      ):
												_lowerCAmelCase										=1_0_0_2_0_0_3 * base_num
												if is_9_pandigital(_lowerCAmelCase      ):
																		return candidate

						return None


if __name__ == "__main__":
							print(F'{solution() = }')






'''simple docstring'''

def 							UpperCamelCase__			(			a__ = 1_0_0_0      ):


						'''simple docstring'''






						_lowerCAmelCase										=2**power
						_lowerCAmelCase										=0
						while n:
												_lowerCAmelCase						,				_lowerCAmelCase										=r + n % 1_0, n // 1_0
						return r


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





