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

hide comments
tor_el: 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
tor_el: 2017-03-16 17:30:35

Last edit: 2017-03-16 17:31:33
ANKIT JAIN: 2017-03-14 18:15:35

AC in one go :)

ameyanator: 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

ankitmas67: 2017-02-04 10:18:46

AC in one go ...just find the pattern

phrs_91: 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
aditya: 2017-01-01 20:48:43

good pattern finding problem

scorpion_ajay: 2016-12-24 11:16:21

finally 20th, learned a lot :)

vengatesh15: 2016-12-23 10:04:57

Easy Pattern ..

c_zenvi01: 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

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