"""simple docstring"""


from __future__ import annotations

from collections import deque




class  UpperCamelCase					:







       def __init__( self,							lowerCAmelCase__)      ->      Union[str, Any]:
            snake_case_					       =					[]
            self.adlist.append(
                {'value': '', 'next_states': [], 'fail_state': 0, 'output': []})

            for keyword in keywords:
                 self.add_keyword(lowerCAmelCase__)
            self.set_fail_transitions()







       def 		a_						( self,							lowerCAmelCase__,							lowerCAmelCase__)      ->      int | None:
            for state in self.adlist[current_state]["next_states"]:
                 if char == self.adlist[state]["value"]:
                      return state
            return None







       def 		a_						( self,							lowerCAmelCase__)      ->      None:
            snake_case_					       =					0
            for character in keyword:
                 snake_case_					       =					self.find_next_state(lowerCAmelCase__,							lowerCAmelCase__)
                 if next_state is None:
                      self.adlist.append(
                          {
                              'value': character,
                              'next_states': [],
                              'fail_state': 0,
                              'output': [],
                          })
                      self.adlist[current_state]["next_states"].append(len(self.adlist) - 1)
                      snake_case_					       =					len(self.adlist) - 1
                 else:
                      snake_case_					       =					next_state
            self.adlist[current_state]["output"].append(lowerCAmelCase__)







       def 		a_						( self)      ->      None:
            snake_case_					       =					deque()
            for node in self.adlist[0]["next_states"]:
                 q.append(lowerCAmelCase__)
                 snake_case_					       =					0
            while q:
                 snake_case_					       =					q.popleft()
                 for child in self.adlist[r]["next_states"]:
                      q.append(lowerCAmelCase__)
                      snake_case_					       =					self.adlist[r]['fail_state']
                      while (
                          self.find_next_state(lowerCAmelCase__,							self.adlist[child]['value']) is None
                          and state != 0
                      ):
                           snake_case_					       =					self.adlist[state]['fail_state']
                      snake_case_					       =					self.find_next_state(
                          lowerCAmelCase__,							self.adlist[child]['value'])
                      if self.adlist[child]["fail_state"] is None:
                           snake_case_					       =					0
                      snake_case_					       =					(
                          self.adlist[child]['output']
                          + self.adlist[self.adlist[child]['fail_state']]['output']
                      )







       def 		a_						( self,							lowerCAmelCase__)      ->      dict[str, list[int]]:
            snake_case_					       =					{}  # returns a dict with keywords and list of its occurrences
            snake_case_					       =					0
            for i in range(len(lowerCAmelCase__)):
                 while (
                     self.find_next_state(lowerCAmelCase__,							string[i]) is None
                     and current_state != 0
                 ):
                      snake_case_					       =					self.adlist[current_state]['fail_state']
                 snake_case_					       =					self.find_next_state(lowerCAmelCase__,							string[i])
                 if next_state is None:
                      snake_case_					       =					0
                 else:
                      snake_case_					       =					next_state
                      for key in self.adlist[current_state]["output"]:
                           if key not in result:
                                snake_case_					       =					[]
                           result[key].append(i - len(lowerCAmelCase__) + 1)
            return result


if __name__ == "__main__":
    import doctest

    doctest.testmod()



__A				={str(digit): digit**5 for digit in range(1_0)}





def 			lowerCamelCase_ (				lowerCamelCase__    ):
				return sum(DIGITS_FIFTH_POWER[digit] for digit in str(lowerCamelCase__    )    )





def 			lowerCamelCase_ (				):
				return sum(
				    number
				    for number in range(1_0_0_0	, 1_0_0_0_0_0_0    )
				    if number == digits_fifth_powers_sum(lowerCamelCase__    )    )


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


