PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000180. Số bán nguyên tố thứ K (hai nguyên tố khác nhau)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số bán nguyên tố thứ K (hai nguyên tố khác nhau)

Bazinga!

PHOJ ID: PRIME000185
Original source: SPOJ DCEPC505
Version: PHOJ Extended, one dataset per run.

Problem statement

Consider all positive integers expressible as the product of exactly two distinct prime numbers, sorted increasingly. Given a 1-based index KK, output the KK-th such integer.

Input

A single integer KK.

Output

The KK-th number in this sequence.

Subtasks

  • Subtask 1 (20 points): 1≤K≤1031\le K\le10^3.
  • Subtask 2 (30 points): 103<K≤10510^3<K\le10^5.
  • Subtask 3 (50 points): 105<K≤2⋅10610^5<K\le2\cdot10^6.

Example

Input

7

Output

26

Explanation

The first seven products of two distinct primes are 6, 10, 14, 15, 21, 22, and 26, so the seventh is 26.