'''simple docstring'''

lowerCAmelCase_ : Dict						  =      [0, 2, 4, 6, 8]
lowerCAmelCase_ : List[Any]						  =      [1, 3, 5, 7, 9]


def __a (	__lowerCamelCase			:						int ,		__lowerCamelCase			:						int ,		__lowerCamelCase			:						list[int] ,		__lowerCamelCase			:						int				)	->							int:
      '''simple docstring'''


      if remaining_length == 0:
            if digits[0] == 0 or digits[-1] == 0:
                  return 0

            for i in range(length // 2 - 1 ,		-1 ,		-1				):
                  remainder += digits[i] + digits[length - i - 1]

                  if remainder % 2 == 0:
                        return 0

                  remainder //= 10

            return 1

      if remaining_length == 1:
            if remainder % 2 == 0:
                  return 0

            lowercase_     =      0
            for digit in range(10				):
                  lowercase_     =      digit
                  result += reversible_numbers(
                      0 ,		(remainder + 2 * digit) // 10 ,		UpperCamelCase__ ,		UpperCamelCase__				)
            return result

      lowercase_     =      0
      for digita in range(10				):
            lowercase_     =      digita

            if (remainder + digita) % 2 == 0:
                  lowercase_     =      ODD_DIGITS
            else:
                  lowercase_     =      EVEN_DIGITS

            for digita in other_parity_digits:
                  lowercase_     =      digita
                  result += reversible_numbers(
                      remaining_length - 2 ,		(remainder + digita + digita) // 10 ,		UpperCamelCase__ ,		UpperCamelCase__ ,		)
      return result


def __a (	__lowerCamelCase			:						int = 9				)	->							int:
      '''simple docstring'''


      lowercase_     =      0
      for length in range(1 ,		max_power + 1				):
            result += reversible_numbers(UpperCamelCase__ ,		0 ,		[0] * length ,		UpperCamelCase__				)
      return result


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







'''simple docstring'''

# Author: OMKAR PATHAK, Nwachukwu Chidiebere

# Use a Python dictionary to construct the graph.
from __future__ import annotations

from pprint import pformat
from typing import Generic, TypeVar

lowerCAmelCase_ : Dict						  =      TypeVar("T")





class 							lowercase						(						Generic[T] ):


   def __init__(   self				:	int   ,		__lowerCAmelCase				:	bool = True)      ->					None:
         lowercase_     =      {}  # dictionary of lists
         lowercase_     =      directed


   def __UpperCAmelCase       (   self				:	int   ,		__lowerCAmelCase				:	T   ,		__lowerCAmelCase				:	T)      ->					GraphAdjacencyList[T]:

         if not self.directed:  # For undirected graphs
               # if both source vertex and destination vertex are both present in the
               # adjacency list, add destination vertex to source vertex list of adjacent
               # vertices and add source vertex to destination vertex list of adjacent
               # vertices.
               if source_vertex in self.adj_list and destination_vertex in self.adj_list:
                     self.adj_list[source_vertex].append(__lowerCAmelCase)
                     self.adj_list[destination_vertex].append(__lowerCAmelCase)
               # if only source vertex is present in adjacency list, add destination vertex
               # to source vertex list of adjacent vertices, then create a new vertex with
               # destination vertex as key and assign a list containing the source vertex
               # as it's first adjacent vertex.
               elif source_vertex in self.adj_list:
                     self.adj_list[source_vertex].append(__lowerCAmelCase)
                     lowercase_     =      [source_vertex]
               # if only destination vertex is present in adjacency list, add source vertex
               # to destination vertex list of adjacent vertices, then create a new vertex
               # with source vertex as key and assign a list containing the source vertex
               # as it's first adjacent vertex.
               elif destination_vertex in self.adj_list:
                     self.adj_list[destination_vertex].append(__lowerCAmelCase)
                     lowercase_     =      [destination_vertex]
               # if both source vertex and destination vertex are not present in adjacency
               # list, create a new vertex with source vertex as key and assign a list
               # containing the destination vertex as it's first adjacent vertex also
               # create a new vertex with destination vertex as key and assign a list
               # containing the source vertex as it's first adjacent vertex.
               else:
                     lowercase_     =      [destination_vertex]
                     lowercase_     =      [source_vertex]
         else:  # For directed graphs
               # if both source vertex and destination vertex are present in adjacency
               # list, add destination vertex to source vertex list of adjacent vertices.
               if source_vertex in self.adj_list and destination_vertex in self.adj_list:
                     self.adj_list[source_vertex].append(__lowerCAmelCase)
               # if only source vertex is present in adjacency list, add destination
               # vertex to source vertex list of adjacent vertices and create a new vertex
               # with destination vertex as key, which has no adjacent vertex
               elif source_vertex in self.adj_list:
                     self.adj_list[source_vertex].append(__lowerCAmelCase)
                     lowercase_     =      []
               # if only destination vertex is present in adjacency list, create a new
               # vertex with source vertex as key and assign a list containing destination
               # vertex as first adjacent vertex
               elif destination_vertex in self.adj_list:
                     lowercase_     =      [destination_vertex]
               # if both source vertex and destination vertex are not present in adjacency
               # list, create a new vertex with source vertex as key and a list containing
               # destination vertex as it's first adjacent vertex. Then create a new vertex
               # with destination vertex as key, which has no adjacent vertex
               else:
                     lowercase_     =      [destination_vertex]
                     lowercase_     =      []

         return self


   def __repr__(   self				:	str)      ->					str:
         return pformat(self.adj_list)






