EIGHTS - Triple Fat Ladies

Pattern Matchers have been designed for various sorts of patterns. Mr. HKP likes to observe patterns in numbers. After completing his extensive research on the squares of numbers, he has moved on to cubes. Now he wants to know all numbers whose cube ends in 888.

Given a number k, help Mr. HKP find the kth number (indexed from 1) whose cube ends in 888.

Input

The first line of the input contains an integer t, the number of test cases. t test cases follow.

Each test case consists of a single line containing a single integer k (1 <= k <= 2000000000000).

Output

For each test case, output a single integer which denotes the kth number whose cube ends in 888. The result will be less than 263.

Example

Input:
1
1

Output:
192

Added by:Matthew Reeder
Date:2006-10-30
Time limit:1.197s
Source limit:30000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Al-Khawarizm 2006

hide comments
2017-03-14 18:15:35 ANKIT JAIN
AC in one go :)
2017-03-01 08:16:06
My solution in c++ gave a wrong ans. Coded the same thing in java and got an AC! lol
2017-02-04 10:18:46
AC in one go ...just find the pattern
2017-01-23 21:18:03
LOL!! damm easy >>>o(1).....use spoj toolkit(http://spojtoolkit.com/test/EIGHTS ) to find formula for this problem!!!!
just one line code and u get it

Last edit: 2017-01-23 21:27:54
2017-01-01 20:48:43 aditya
good pattern finding problem
2016-12-24 11:16:21
finally 20th, learned a lot :)
2016-12-23 10:04:57
Easy Pattern ..
2016-12-23 06:00:29
Find the first 5 sequence, get the very easy pattern, implement a junior high school math formula, AC in one go.

Last edit: 2016-12-23 06:05:06
2016-12-14 10:57:19
little analysis of pattern after that just two lines code in python
try to print first 10 numbers and you will get the pattern
2016-12-08 09:24:29
o(1) in c AC in one go !!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.