import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0) {
int n = sc.nextInt();
int decimal = 0;
int p=0;
while(n!=0) {
decimal+=((n%10)*Math.pow(2,p));
n=n/10;
}
System.out.println(decimal);
t–;
}
}
}
sir can u tell me why it is not able to solve testcases