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

#SP0000088. Thứ tự sắp xếp đặc biệt (False Ordering)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Thứ tự sắp xếp đặc biệt (False Ordering)

False Ordering

Source: LightOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Consider all integers from 11 to 10001000. Let d(x)d(x) denote the number of positive divisors of xx. Sort the integers by two rules: (1) those with fewer divisors come first; (2) on equal divisor counts, the larger integer comes first. Given 1-based position nn, find the integer at that position in the sorted list.

Input

One line contains the integer nn, the requested 1-based rank in the sorted sequence.

Output

Print exactly one line Case 1: X, where X is the integer at rank nn. The label Case 1: is retained from the original output convention.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100.
  • Subtask 2 (30 points): 1≤n≤6001\le n\le 600.
  • Subtask 3 (50 points): 1≤n≤10001\le n\le 1000.

Examples

Input

2

Output

Case 1: 997

Explanation

The number 11 has exactly one positive divisor and therefore ranks first. Every prime at most 10001000 has two divisors; among these, integers are ordered decreasingly, and the largest prime is 997997, which ranks second. Thus for n=2n=2, print Case 1: 997.