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

#TP0000060. Quy tắc mới ở Euphomia (The New Rule in Euphomia)

HỌC THEO LỘ TRÌNH

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

2 lộ trình

Quy tắc mới ở Euphomia (The New Rule in Euphomia)

The New Rule in Euphomia

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

In Euphomia, unordered pairs of two different prime numbers are considered. Given an integer NN, a pair (p,q)(p,q) counts if both numbers are prime, p<qp<q, and p+q≤Np+q\le N.

Determine the number of such pairs. Following the UVa case-label format, print Case 1: X, where XX is the count for the given data set.

Input

  • One line contains integer NN: the upper bound on the sum of the two primes.

Output

Print one line in the exact form Case 1: X, where XX is the number of distinct-prime pairs with sum at most NN.

Subtasks

  • Subtask 1 (20 points): 4≤N≤504\le N\le 50; NN is an integer.
  • Subtask 2 (30 points): 4≤N≤50004\le N\le 5000; NN is an integer.
  • Subtask 3 (50 points): 4≤N≤10000004\le N\le 1000000; NN is an integer.

Examples

Input

10

Output

Case 1: 5

Explanation

For N=10N=10, the primes up to 1010 are 2,3,5,72,3,5,7. The five distinct-prime pairs satisfying the bound are (2,3)(2,3), (2,5)(2,5), (2,7)(2,7), (3,5)(3,5) and (3,7)(3,7). Pair (5,5)(5,5) is excluded because the primes must be different. Hence the required line is Case 1: 5.