program salads;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
 n,a, rez, i: integer;
 mas:array[1..32] of integer;
begin
assign (input,'salads.in'); reset (input);
mas[1] := 0;
mas[2] := 1;
mas[3] := 4;
  for i:=2 to 32 do begin
    mas[i] := mas[i-1] *2 + (i-1);
  end;


read (a);
  for i:=1 to a do begin
 read(n);
write (mas[n]);
writeln;
end;

  { TODO -oUser -cConsole Main : Insert code here }
end.
