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-06-12 23:56:05
Haha 3 lines of code....
2017-06-10 15:46:26
Don't give up :) I struggled with this many hours and at times I thought too complexly.

Last edit: 2017-06-10 15:48:33
2017-06-09 12:14:08
In c++ use boost multiprecision 5-7 line code !!
2017-05-30 12:16:49 awanesh
should have given 2 test cases
2017-05-28 15:37:34
very bad explanation :(


Last edit: 2017-05-28 15:54:32
2017-05-24 16:27:27
Got it!! But I don't see any good in this pattern!! What is relation b/w 888 and the logic?? How we get logic without seeing 1st few test cases in spoj tool kit?? What is the relation b/w Cubes or 888 and 250??
2017-05-22 06:26:15 Simran Saha
Required more test cases....at least one more :P
2017-05-18 16:31:51
Very easy! Lol!! Good Pattern, though!
2017-03-28 15:35:38
AC in 1 go :)
2017-03-17 14:34:22
if you want to handle the large numbers in c++ try storing and printing them as a string

Last edit: 2017-03-17 14:35:31
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.