#include <fstream>
#include <math.h>
using namespace std;
long i, a[100000];
ifstream f1("dayso.inp");
ofstream f2("doinp.out");
double tinh(long a)
{
	double s = 0, n = 1;
	while (a > 0)
	{
		s = s + n * (a%2);
		a = a / 2;
		n = n * 10;
	}
	return s;
}
int main()
{
	f1 >> i;
	for (long n = 0; n < i; n++) f1 >> a[n];
	for (long n = 0; n < i; n++) f2 << tinh(a[n]) << endl;
    return 0;
}
