Expresie

Time limit: 0.3s Memory limit: 64MB Input: Output:

Lensu finished the 9th grade with an average of 9.49 in mathematics and computer science. He was very eager to achieve a 10 average, because otherwise, he wouldn't get a scholarship next year. So, he proposed the following to his math and computer science teacher, Marlena:
- If you give me a 10 average for the 2022-2023 year, I will solve any problem you want during the summer vacation!
The teacher responded by saying that if he fails, she will give him a grade of 2 next year. Ambitious, Lensu accepted the condition.

Task

The teacher's problem is as follows:
Given the following expression:

E(x)=x43x32x2+51000+10E(x) = \frac{x^4 - 3x^3 - 2x^2 + 5}{1000} + 10

and QQ numbers KK.

Determine for how many natural numbers xx, 4x10,0004 \leq x \leq 10,000, the inequality E(x)KE(x) \leq K holds.

Help Lensu solve this problem, and he will reward you with 100 points and 100 IQ.

Input data

The first line will contain the number QQ, and the following QQ lines will each contain a natural number KK.

Output data

Print QQ natural numbers, each on a new line, representing the answer to each number KK in order.

Constraints and clarifications

  • It is guaranteed that there is at least one natural number xx that satisfies the relationship.
  • KK can be represented on 64-bit signed integer.
  • 4x10,0004 \leq x \leq 10,000;
  • 1Q100,0001 \leq Q \leq 100,000;
  • For 30 points, 4x1004 \leq x \leq 100.

Example

stdin

3
12
100
11

stdout

4
15
3

Explanation

For the first number K=12K = 12, there are 4 numbers 4x4 \leq x that satisfy the inequality E(x)KE(x) \leq K.

Log in or sign up to be able to send submissions!