from math import inf, sqrt, ceil def is_prime(num: int) -> bool: for candidate in range(2, ceil(sqrt(num))): if num % candidate == 0: return False else: return True def main(): N = int(input()) prime_over_10000 = [] for number in range(100001, 103000): if is_prime(number): prime_over_10000.append(number) match N: case 1: print(1) case 2: print(prime_over_10000[0]**2) case 3: print(prime_over_10000[0]*prime_over_10000[1]) case _: current_first_idx = [0, 1] current_second_idx = [2, 1] for _ in range(4, N+1): now_number = inf now_index = None for idx, (first, second) in enumerate(zip( current_first_idx, current_second_idx)): if prime_over_10000[first] * prime_over_10000[second] < now_number: now_number = prime_over_10000[first] * \ prime_over_10000[second] now_index = idx if current_second_idx[now_index] not in current_first_idx: current_first_idx.append(current_second_idx[now_index]) current_second_idx.append(current_second_idx[now_index]) current_second_idx[now_index] += 1 print(now_number) if __name__ == "__main__": main()