#include <stdio.h>
#define MAXX 200000
int cmmdc ( int a , int b ) {
int auxr;
while ( b > 0 ) {
auxr = a % b;
a = b;
b = auxr;
}
return a;
}
int main () {
FILE *fin , *fout;
int n , i , j , x;
long long px;
fin = fopen ( "sum.in" , "r" );
fscanf ( fin , "%d" , &n );
fout = fopen ( "sum.out" , "w" );
for ( i = 0 ; i < n ; i++ ) {
fscanf ( fin , "%d" , &x );
px = 0;
for ( j = 1 ; j <= 2 * x ; j++ )
if ( cmmdc ( x , j ) == 1 )
px = px + x;
fprintf ( fout , "%lld\n" , px );
}
fclose ( fin );
fclose ( fout );
return 0;
}