ARCTAN - Use of Function Arctan

no tags 

It's easy to know that arctan(1/2) + arctan(1/3) = arctan(1). Given number A, write a program to calculate the minimum sum B+C. A, B and C are all positive integers and satisfy the equation below:

arctan(1/A) = arctan(1/B) + arctan(1/C)

Input

The first line contains a integer number T (about 1000). T lines follow, each contains a single integer A, 1<=A<=60000.

Output

T lines, each contains a single integer which denotes to the minimum sum B+C.

Example

Sample input:
1
1

Sample output:
5

Added some new test data.


hide comments
hetp111: 2019-05-30 17:09:22

Calculus?

amir_ofir: 2018-10-03 14:17:51

No one did it on Python. always time exeeded

dvynsh_chan17: 2017-10-17 20:28:52

how can i make this below 256b????????

Last edit: 2017-10-21 12:44:38
albertg: 2014-09-11 15:25:13

nice problem

ওয়াসী (Wasi): 2013-05-23 10:52:38

tricky one!
at last managed to solve under 256 bytes... :D

Himanshu: 2013-01-30 09:02:30

i dont know why it gives WA???

saket diwakar: 2013-01-15 17:18:08

nice and tricky....:)


Added by:Fudan University Problem Setters
Date:2007-03-31
Time limit:2s
Source limit:256B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: C99 ERL GOSU JS-RHINO OBJC
Resource:Chinese National Olympiad in Informatics 2001,Day 1; translated by Blue Mary