


class  snake_case_     :  # Public class to implement a graph
					def __init__(   self     :Union[str, Any]    ,__snake_case     :int    ,__snake_case     :int    ,__snake_case     :list[list[bool]]   )      ->					None:
												a__    =  row
												a__    =  col
												a__    =  graph
					def 				lowerCamelCase__(   self     :List[Any]    ,__snake_case     :int    ,__snake_case     :int    ,__snake_case     :list[list[bool]]   )      ->					bool:
												return (
												    0 <= i < self.ROW
												    and 0 <= j < self.COL
												    and not visited[i][j]
												    and self.graph[i][j]
												)
					def 				lowerCamelCase__(   self     :str    ,__snake_case     :int    ,__snake_case     :int    ,__snake_case     :list[list[bool]]   )      ->					None:
												# Checking all 8 elements surrounding nth element
												a__    =  [-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
												a__    =  [-1, 0, 1, -1, 1, -1, 0, 1]
												a__    =  True  # Make those cells visited
												for k in range(8   ):
																			if self.is_safe(i + row_nbr[k]    ,j + col_nbr[k]    ,__snake_case   ):
																										self.diffs(i + row_nbr[k]    ,j + col_nbr[k]    ,__snake_case   )



					def 				lowerCamelCase__(   self     :Any   )      ->					int:  # And finally, count all islands.
												a__    =  [[False for j in range(self.COL   )] for i in range(self.ROW   )]
												a__    =  0
												for i in range(self.ROW   ):
																			for j in range(self.COL   ):
																										if visited[i][j] is False and self.graph[i][j] == 1:
																																	self.diffs(__snake_case    ,__snake_case    ,__snake_case   )
																																	count += 1
												return count








from math import sqrt






def 							__lowercase     (				__lowerCAmelCase							:       int     ):

							if 1 < number < 4:
														# 2 and 3 are primes
														return True
							elif number < 2 or number % 2 == 0 or number % 3 == 0:
														# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
														return False

							# All primes number are in format of 6k +/- 1
							for i in range(5      ,					int(sqrt(__lowerCAmelCase     ) + 1     )      ,					6     ):
														if number % i == 0 or number % (i + 2) == 0:
																					return False
							return True






def 							__lowercase     (				__lowerCAmelCase							:       int = 1_0_0_0_1     ):
							a__    =  0
							a__    =  1
							while count != nth and number < 3:
														number += 1
														if is_prime(__lowerCAmelCase     ):
																					count += 1
							while count != nth:
														number += 2
														if is_prime(__lowerCAmelCase     ):
																					count += 1
							return number


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




