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

#SP0000087. Sắp xếp theo số thừa số nguyên tố có lặp (A Different Kind of Sorting)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Sắp xếp theo số thừa số nguyên tố có lặp (A Different Kind of Sorting)

A Different Kind of Sorting

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Consider all integers from 11 through 20000002000000, sorted by the total number of prime factors counting multiplicity, ascending. Ties are broken by smaller integer first. The integer 11 has zero prime factors. For example, 20=2⋅2⋅520=2\cdot2\cdot5 has three factors, while 35=5⋅735=5\cdot7 has two. Given a 11-based rank nn, output the number at that rank.

Input

One line contains the rank nn.

Output

Print one line in the exact format Case 1: x, where xx is the value at rank nn.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100; sorting domain is exactly [1,2000000][1,2000000].
  • Subtask 2 (30 points): 1≤n≤100001\le n\le 10000; sorting domain is exactly [1,2000000][1,2000000].
  • Subtask 3 (50 points): 1≤n≤20000001\le n\le 2000000; sorting domain is exactly [1,2000000][1,2000000].

Examples

Input

4

Output

Case 1: 5

Explanation

The integer 11 has zero prime factors and comes first. All primes have exactly one prime factor and appear as 2,3,5,7,…2,3,5,7,\ldots. The first four elements are therefore 1,2,3,51,2,3,5, so rank 44 contains 55 and the output is Case 1: 5.