Right triangle

Right triangle

Time Limit: 2.0 s

Memory Limit: 32.0 MB

Description

A right-angled triangle is a triangle in which one of three angle is 90 degree. Three sides of the triangle are named as height,base and hypotenuse (opposite side of right angle).

You are given the base B of the triangle which is a positive integer. Your task is to find a right-angled triangle of which the base is B and other two sides (height,hypotenuse) are also positive integers. Print the perimeter of the triangle.
If there are many answers print the largest perimeter possible.

Note:
* perimeter is the sum of three sides of a triangle
* integer is a whole number (without fraction). such as 1,2,3,...50,10 are integers and 1.4, 5.99, 3.01 are not.

Input

first line of input takes an integer T: number of testcases
each testcase, takes an integer B: base of the triangle
1 <= \(T\) <= 10
1 <= \(B\) <= 1000

Output

print T lines, each line should consist an integer : perimeter of the triangle
if there is no triangle possible print -1

Sample

Input Output
2
1
3
-1
12

in case 1, it is not possible to make a triangle which has a base 1 and two other sides of positive integer length.
in case 2, base = 3, height = 4 , hypotenuse = 5 so the perimeter is 3+4+5=12. It can be shown that it is not possible to construct any other triangle which has a larger perimeter than 12 with base 3.

Information

ID
1027
Difficulty
7
Category
(None)
Tags
(None)
# Submissions
46
Accepted
11
Accepted Ratio
24%
Uploaded By

Related

In following contests:

Brain booster #2