Set of Rectangles

No attempts yetTime limit2sMemory limit128 MB

Problem

A Pythagorean triple is three positive integers aa, bb, cc with a2+b2=c2a^2 + b^2 = c^2, written as (a,b,c)(a, b, c). Picking integers xx and yy with x>y>0x > y > 0 and setting a=2xya = 2xy, b=x2y2b = x^2 - y^2, c=x2+y2c = x^2 + y^2 produces a Pythagorean triple.

R={R1,R2,,Ri,}\mathbb{R} = \{R_1, R_2, \ldots, R_i, \ldots\} is a set of rectangles. Rectangle RiR_i has width wiw_i, height hih_i, and diagonal length did_i. When every rectangle in R\mathbb{R} satisfies the conditions below, the set is called a Pythagorean base rectangle set.

  • (wi,hi,di)(w_i, h_i, d_i) is a Pythagorean triple.
  • wi<hiw_i < h_i
  • hiwihjwj\dfrac{h_i}{w_i} \neq \dfrac{h_j}{w_j} whenever iji \neq j

Changyoung, a student at Pythagoras High School, plays with a wire of length LL. He cuts the wire into pieces and bends each piece into one rectangle, and the set of rectangles he ends up with must be a Pythagorean base rectangle set. Making RiR_i uses 2(wi+hi)2(w_i + h_i) of wire.

Write rectangle RiR_i as the pair of width and height (wi,hi)(w_i, h_i). When LL is 94, Changyoung can make 3 rectangles, for instance R={(3,4),(5,12),(8,15)}\mathbb{R} = \{(3, 4), (5, 12), (8, 15)\}. Building R={(3,4),(7,24)}\mathbb{R} = \{(3, 4), (7, 24)\} from the same wire leaves him with only 2 rectangles.

Given LL, write a program that finds the largest number of rectangles Changyoung can make.

Input

The first line contains the number of test cases TT. Each test case is a single line holding the wire length LL. (14L1,000,00014 \le L \le 1{,}000{,}000)

Output

For each test case, print on one line the largest number of rectangles Changyoung can make from a wire of length LL.