P13809 [CodeChef] chearmy
NOI
题目描述

The Head Chef is receiving a lot of orders for cooking the best of the problems lately. For this, he organized an hiring event to hire some talented Chefs. He gave the following problem to test the skills of the participating Chefs. Can you solve this problem and be eligible for getting hired by Head Chef.

A non-negative number n is said to be magical if it satisfies the following property. Let S denote the multi-set of numbers corresponding to the non-empty subsequences of the digits of the number n in decimal representation. Please note that the numbers in the set S can have leading zeros. Let us take an element s of the multi-set S, prod(s) denotes the product of all the digits of number s in decimal representation.
The number n will be called magical if sum of prod(s) for all elements s in S, is even.

For example, consider a number 246, its all possible non-empty subsequence will be S = {2, 4, 6, 24, 46, 26, 246}. Products of digits of these subsequences will be {prod(2) = 2, prod(4) = 4, prod(6) = 6, prod(24) = 8, prod(46) = 24, prod(26) = 12, prod(246) = 48, i.e. {2, 4, 6, 8, 24, 12, 48}. Sum of all of these is 104, which is even. Hence 246 is a magical number.

Please note that multi-set S can contain repeated elements, e.g. if number is 55, then S = {5, 5, 55}. Products of digits of these subsequences will be {prod(5) = 5, prod(5) = 5, prod(55) = 25}, i.e. {5, 5, 25}. Sum of all of these is 35 which is odd. Hence 55 is not a
magical number.

Consider a number 204, then S = {2, 0, 4, 20, 04, 24, 204}. Products of digits of these subsequences will be {2, 0, 4, 0, 0, 8, 0}. Sum of all these elements will be 14 which is even. So 204 is a magical number.

The task was to simply find the K^th magical number.

Input

First line of the input contains an integer T denoting the number of test cases.
Each of the next T lines contains a single integer K.

Output
For each test case, print a single integer corresponding to the K^th magical number.

Constraints

1 ≤ T ≤ 10^5
1 ≤ K ≤ 10^12.

Example
Input:
2
2
5

Output:
2
8

Explanation
Example case 1.
2 is the 2^nd magical number, since it satisfies the property of the magical number. The first magical number will be of course 0.

输入格式

见题面

输出格式

见题面

样例输入
2 2 5
样例输出
2 8