


'''simple docstring'''






from collections import deque
from math import floor
from random import random
from time import time




class 	a__       :





							'''simple docstring'''






							def __init__(	self     ) ->							Optional[Any]:
														lowerCAmelCase__      =			{}







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_      ,					lowerCamelCase_      ,					lowerCamelCase_=1     ) ->							Tuple:
														if self.graph.get(lowerCamelCase_     ):
																					if self.graph[u].count([w, v]     ) == 0:
																												self.graph[u].append([w, v]     )
														else:
																					lowerCAmelCase__      =			[[w, v]]
														if not self.graph.get(lowerCamelCase_     ):
																					lowerCAmelCase__      =			[]







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Tuple:
														return list(self.graph     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_      ,					lowerCamelCase_     ) ->							Optional[int]:
														if self.graph.get(lowerCamelCase_     ):
																					for _ in self.graph[u]:
																												if _[1] == v:
																																			self.graph[u].remove(lowerCamelCase_     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2      ,					lowerCamelCase_=-1     ) ->							int:
														if s == d:
																					return []
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														if s == -2:
																					lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			s

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if visited.count(node[1]     ) < 1:
																																										if node[1] == d:
																																																	visited.append(lowerCamelCase_     )
																																																	return visited
																																										else:
																																																	stack.append(node[1]     )
																																																	visited.append(node[1]     )
																																																	lowerCAmelCase__      =			node[1]
																																																	break

            # check if all the children are visited
																					if s == ss:
																												stack.pop()
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return visited







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-1     ) ->							Union[str, Any]:
														if c == -1:
																					lowerCAmelCase__      =			floor(random() * 1_00_00     ) + 10
														for i in range(lowerCamelCase_     ):
																					# every vertex has max 100 edges
																					for _ in range(floor(random() * 1_02     ) + 1     ):
																												lowerCAmelCase__      =			floor(random() * c     ) + 1
																												if n != i:
																																			self.add_pair(lowerCamelCase_      ,					lowerCamelCase_      ,					1     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2     ) ->							List[str]:
														lowerCAmelCase__      =			deque()
														lowerCAmelCase__      =			[]
														if s == -2:
																					lowerCAmelCase__      =			list(self.graph     )[0]
														d.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														while d:
																					lowerCAmelCase__      =			d.popleft()
																					if len(self.graph[s]     ) != 0:
																												for node in self.graph[s]:
																																			if visited.count(node[1]     ) < 1:
																																										d.append(node[1]     )
																																										visited.append(node[1]     )
														return visited







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_     ) ->							int:
														lowerCAmelCase__      =			0
														for x in self.graph:
																					for y in self.graph[x]:
																												if y[1] == u:
																																			count += 1
														return count







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_     ) ->							List[str]:
														return len(self.graph[u]     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2     ) ->							Optional[Any]:
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														if s == -2:
																					lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			s
														lowerCAmelCase__      =			[]

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if visited.count(node[1]     ) < 1:
																																										stack.append(node[1]     )
																																										visited.append(node[1]     )
																																										lowerCAmelCase__      =			node[1]
																																										break

            # check if all the children are visited
																					if s == ss:
																												sorted_nodes.append(stack.pop()     )
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return sorted_nodes







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Union[str, Any]:
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			-2
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			s
														lowerCAmelCase__      =			False
														lowerCAmelCase__      =			set()

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if (
																																			    visited.count(node[1]     ) > 0
																																			    and node[1] != parent
																																			    and indirect_parents.count(node[1]     ) > 0
																																			    and not on_the_way_back
																																			):
																																										lowerCAmelCase__      =			len(lowerCamelCase_     ) - 1
																																										while len_stack >= 0:
																																																	if stack[len_stack] == node[1]:
																																																								anticipating_nodes.add(node[1]     )
																																																								break
																																																	else:
																																																								anticipating_nodes.add(stack[len_stack]     )
																																																								len_stack -= 1
																																			if visited.count(node[1]     ) < 1:
																																										stack.append(node[1]     )
																																										visited.append(node[1]     )
																																										lowerCAmelCase__      =			node[1]
																																										break

            # check if all the children are visited
																					if s == ss:
																												stack.pop()
																												lowerCAmelCase__      =			True
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			False
																												indirect_parents.append(lowerCamelCase_     )
																												lowerCAmelCase__      =			s
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return list(lowerCamelCase_     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Optional[Any]:
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			-2
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			s
														lowerCAmelCase__      =			False
														lowerCAmelCase__      =			set()

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if (
																																			    visited.count(node[1]     ) > 0
																																			    and node[1] != parent
																																			    and indirect_parents.count(node[1]     ) > 0
																																			    and not on_the_way_back
																																			):
																																										lowerCAmelCase__      =			len(lowerCamelCase_     ) - 1
																																										while len_stack_minus_one >= 0:
																																																	if stack[len_stack_minus_one] == node[1]:
																																																								anticipating_nodes.add(node[1]     )
																																																								break
																																																	else:
																																																								return True
																																			if visited.count(node[1]     ) < 1:
																																										stack.append(node[1]     )
																																										visited.append(node[1]     )
																																										lowerCAmelCase__      =			node[1]
																																										break

            # check if all the children are visited
																					if s == ss:
																												stack.pop()
																												lowerCAmelCase__      =			True
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			False
																												indirect_parents.append(lowerCamelCase_     )
																												lowerCAmelCase__      =			s
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return False







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2      ,					lowerCamelCase_=-1     ) ->							int:
														lowerCAmelCase__      =			time()
														self.dfs(lowerCamelCase_      ,					lowerCamelCase_     )
														lowerCAmelCase__      =			time()
														return end - begin







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2     ) ->							Tuple:
														lowerCAmelCase__      =			time()
														self.bfs(lowerCamelCase_     )
														lowerCAmelCase__      =			time()
														return end - begin




class 	a__       :





							'''simple docstring'''






							def __init__(	self     ) ->							Any:
														lowerCAmelCase__      =			{}







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_      ,					lowerCamelCase_      ,					lowerCamelCase_=1     ) ->							List[Any]:
														# check if the u exists
														if self.graph.get(lowerCamelCase_     ):
																					# if there already is a edge
																					if self.graph[u].count([w, v]     ) == 0:
																												self.graph[u].append([w, v]     )
														else:
																					# if u does not exist
																					lowerCAmelCase__      =			[[w, v]]
														# add the other way
														if self.graph.get(lowerCamelCase_     ):
																					# if there already is a edge
																					if self.graph[v].count([w, u]     ) == 0:
																												self.graph[v].append([w, u]     )
														else:
																					# if u does not exist
																					lowerCAmelCase__      =			[[w, u]]







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_      ,					lowerCamelCase_     ) ->							List[str]:
														if self.graph.get(lowerCamelCase_     ):
																					for _ in self.graph[u]:
																												if _[1] == v:
																																			self.graph[u].remove(lowerCamelCase_     )
        # the other way round
														if self.graph.get(lowerCamelCase_     ):
																					for _ in self.graph[v]:
																												if _[1] == u:
																																			self.graph[v].remove(lowerCamelCase_     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2      ,					lowerCamelCase_=-1     ) ->							Union[str, Any]:
														if s == d:
																					return []
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														if s == -2:
																					lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			s

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if visited.count(node[1]     ) < 1:
																																										if node[1] == d:
																																																	visited.append(lowerCamelCase_     )
																																																	return visited
																																										else:
																																																	stack.append(node[1]     )
																																																	visited.append(node[1]     )
																																																	lowerCAmelCase__      =			node[1]
																																																	break

            # check if all the children are visited
																					if s == ss:
																												stack.pop()
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return visited







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-1     ) ->							Any:
														if c == -1:
																					lowerCAmelCase__      =			floor(random() * 1_00_00     ) + 10
														for i in range(lowerCamelCase_     ):
																					# every vertex has max 100 edges
																					for _ in range(floor(random() * 1_02     ) + 1     ):
																												lowerCAmelCase__      =			floor(random() * c     ) + 1
																												if n != i:
																																			self.add_pair(lowerCamelCase_      ,					lowerCamelCase_      ,					1     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2     ) ->							Dict:
														lowerCAmelCase__      =			deque()
														lowerCAmelCase__      =			[]
														if s == -2:
																					lowerCAmelCase__      =			list(self.graph     )[0]
														d.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														while d:
																					lowerCAmelCase__      =			d.popleft()
																					if len(self.graph[s]     ) != 0:
																												for node in self.graph[s]:
																																			if visited.count(node[1]     ) < 1:
																																										d.append(node[1]     )
																																										visited.append(node[1]     )
														return visited







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_     ) ->							Optional[Any]:
														return len(self.graph[u]     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							int:
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			-2
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			s
														lowerCAmelCase__      =			False
														lowerCAmelCase__      =			set()

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if (
																																			    visited.count(node[1]     ) > 0
																																			    and node[1] != parent
																																			    and indirect_parents.count(node[1]     ) > 0
																																			    and not on_the_way_back
																																			):
																																										lowerCAmelCase__      =			len(lowerCamelCase_     ) - 1
																																										while len_stack >= 0:
																																																	if stack[len_stack] == node[1]:
																																																								anticipating_nodes.add(node[1]     )
																																																								break
																																																	else:
																																																								anticipating_nodes.add(stack[len_stack]     )
																																																								len_stack -= 1
																																			if visited.count(node[1]     ) < 1:
																																										stack.append(node[1]     )
																																										visited.append(node[1]     )
																																										lowerCAmelCase__      =			node[1]
																																										break

            # check if all the children are visited
																					if s == ss:
																												stack.pop()
																												lowerCAmelCase__      =			True
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			False
																												indirect_parents.append(lowerCamelCase_     )
																												lowerCAmelCase__      =			s
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return list(lowerCamelCase_     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Tuple:
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			list(self.graph     )[0]
														stack.append(lowerCamelCase_     )
														visited.append(lowerCamelCase_     )
														lowerCAmelCase__      =			-2
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			s
														lowerCAmelCase__      =			False
														lowerCAmelCase__      =			set()

														while True:
																					# check if there is any non isolated nodes
																					if len(self.graph[s]     ) != 0:
																												lowerCAmelCase__      =			s
																												for node in self.graph[s]:
																																			if (
																																			    visited.count(node[1]     ) > 0
																																			    and node[1] != parent
																																			    and indirect_parents.count(node[1]     ) > 0
																																			    and not on_the_way_back
																																			):
																																										lowerCAmelCase__      =			len(lowerCamelCase_     ) - 1
																																										while len_stack_minus_one >= 0:
																																																	if stack[len_stack_minus_one] == node[1]:
																																																								anticipating_nodes.add(node[1]     )
																																																								break
																																																	else:
																																																								return True
																																			if visited.count(node[1]     ) < 1:
																																										stack.append(node[1]     )
																																										visited.append(node[1]     )
																																										lowerCAmelCase__      =			node[1]
																																										break

            # check if all the children are visited
																					if s == ss:
																												stack.pop()
																												lowerCAmelCase__      =			True
																												if len(lowerCamelCase_     ) != 0:
																																			lowerCAmelCase__      =			stack[len(lowerCamelCase_     ) - 1]
																					else:
																												lowerCAmelCase__      =			False
																												indirect_parents.append(lowerCamelCase_     )
																												lowerCAmelCase__      =			s
																												lowerCAmelCase__      =			ss

																					# check if se have reached the starting point
																					if len(lowerCamelCase_     ) == 0:
																												return False







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							int:
														return list(self.graph     )







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2      ,					lowerCamelCase_=-1     ) ->							List[str]:
														lowerCAmelCase__      =			time()
														self.dfs(lowerCamelCase_      ,					lowerCamelCase_     )
														lowerCAmelCase__      =			time()
														return end - begin







							def 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_=-2     ) ->							str:
														lowerCAmelCase__      =			time()
														self.bfs(lowerCamelCase_     )
														lowerCAmelCase__      =			time()
														return end - begin



'''simple docstring'''






def       _snake_case     (  A )		->					int:
							return 1 if digit in (0, 1) else (digit * factorial(digit - 1 ))


def       _snake_case     (  A )		->					bool:
							lowerCAmelCase__      =			0
							lowerCAmelCase__      =			number
							while duplicate > 0:
														lowerCAmelCase__     ,      lowerCAmelCase__      =			divmod(A				,					10 )
														fact_sum += factorial(A )
							return fact_sum == number


if __name__ == "__main__":
		print('''Program to check whether a number is a Krisnamurthy Number or not.''')
		__UpperCAmelCase					       =							int(input('''Enter number: ''').strip())
		print(
		    f"""{number} is {'' if krishnamurthy(number) else 'not '}a Krishnamurthy Number."""
		)