



from itertools import permutations

def 			a		( _UpperCAmelCase				:   Optional[Any] = 5		):







		'''simple docstring'''





		if gon_side < 3 or gon_side > 5:
				raise ValueError('''gon_side must be in the range [3, 5]'''		)

		# Since it's 16, we know 10 is on the outer ring
		# Put the big numbers at the end so that they are never the first number
		__UpperCAmelCase       :	Optional[int]						=      list(range(gon_side + 1					,  0					,  -1		)		)
		__UpperCAmelCase       :	Tuple						=      list(range(gon_side + 2					,  gon_side * 2 + 1		)		)

		for perm in permutations(small_numbers + big_numbers		):
				__UpperCAmelCase       :	Optional[int]						=      generate_gon_ring(_UpperCAmelCase					,  list(_UpperCAmelCase		)		)
				if is_magic_gon(_UpperCAmelCase		):
						return int(''''''.join(str(_UpperCAmelCase		) for n in numbers		)		)

		__UpperCAmelCase       :	Any						=      f'Magic {gon_side}-gon ring is impossible'
		raise ValueError(_UpperCAmelCase		)

def 			a		( _UpperCAmelCase				:   Optional[int]					,  _UpperCAmelCase				:   Optional[int]		):







		'''simple docstring'''





		__UpperCAmelCase       :	str						=      [0] * (gon_side * 3)
		__UpperCAmelCase       :	str						=      perm[0:3]
		perm.append(perm[1]		)

		__UpperCAmelCase       :	Optional[Any]						=      1 if gon_side < 5 else 2

		for i in range(1					,  len(_UpperCAmelCase		) // 3 + magic_number		):
				__UpperCAmelCase       :	List[Any]						=      perm[2 * i + 1]
				__UpperCAmelCase       :	Optional[Any]						=      result[3 * i - 1]
				__UpperCAmelCase       :	List[Any]						=      perm[2 * i + 2]

		return result

def 			a		( _UpperCAmelCase				:   List[str]		):







		'''simple docstring'''





		if len(_UpperCAmelCase		) % 3 != 0:
				raise ValueError('''a gon ring should have a length that is a multiple of 3'''		)

		if min(numbers[::3]		) != numbers[0]:
				return False

		__UpperCAmelCase       :	Optional[int]						=      sum(numbers[:3]		)

		return all(sum(numbers[i : i + 3]		) == total for i in range(3					,  len(_UpperCAmelCase		)					,  3		)		)


if __name__ == "__main__":
				print(solution())









def 			__lowerCAmelCase       (SCREAMING_SNAKE_CASE = 1000   )->    int:




      """simple docstring"""

      snake_case_			= [0, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8]
      # number of letters in twenty, thirty, ..., ninety (0 for numbers less than
      # 20 due to inconsistency in teens)
      snake_case_			= [0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

      snake_case_			= 0

      for i in range(1   ,   n + 1   ):
            if i < 1000:
                  if i >= 100:
                        # add number of letters for "n hundred"
                        count += ones_counts[i // 100] + 7

                        if i % 100 != 0:
                              # add number of letters for "and" if number is not multiple
                              # of 100
                              count += 3

                  if 0 < i % 100 < 20:
                        # add number of letters for one, two, three, ..., nineteen
                        # (could be combined with below if not for inconsistency in
                        # teens)
                        count += ones_counts[i % 100]
                  else:
                        # add number of letters for twenty, twenty one, ..., ninety
                        # nine
                        count += ones_counts[i % 10]
                        count += tens_counts[(i % 100 - i % 10) // 10]
            else:
                  count += ones_counts[i // 1000] + 8
      return count


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