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

#SP0000139. Tổng số nguyên tố ít nhất (Easy Problem of Prime)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng số nguyên tố ít nhất (Easy Problem of Prime)

Easy Problem of Prime

Source: Codeforces Gym — 104366M

Version: Phước Hưng OJ Extended; one input file per judge run.

Problem Statement

Let f(x)f(x) be the minimum number of primes (repetition allowed) whose sum equals xx. For each of the QQ queries nn, output F(n)=∑i=2nf(i)F(n)=\sum_{i=2}^{n}f(i). Keep all QQ queries in one input to share preprocessing.

Input

First line contains QQ, followed by QQ integers nn.

Output

Print one result per query, in the same order.

Subtask

  • Subtask 1 (20 points): 1≤Q≤1061\le Q\le10^6, 2≤ni≤1002\le n_i\le100.
  • Subtask 2 (30 points): 1≤Q≤1061\le Q\le10^6, 2≤ni≤1000002\le n_i\le100000.
  • Subtask 3 (50 points): 1≤Q≤1061\le Q\le10^6, 2≤ni≤100000002\le n_i\le10000000.

Example

Input

3
3
4
5

Output

2
4
5

Explanation

The example follows the mathematical conditions and the specified output format.