// clang-format off #include using namespace std; using ll = int64_t; using ld = long double; #define FOR(i, m, n) for(int i = (m); i < (n); ++i) #define FORR(i, m, n) for(int i = (m)-1; i >= (n); --i) #define rep(i, n) FOR(i, 0, n) #define repn(i, n) FOR(i, 1, n+1) #define repr(i, n) FORR(i, n, 0) #define repnr(i, n) FORR(i, n+1, 1) #define all(s) (s).begin(), (s).end() template bool chmax(T &a, const U b) { return a < b ? a = b, true : false; } template bool chmin(T &a, const U b) { return b < a ? a = b, true : false; } template istream &operator>>(istream &is, vector &v) { for (T &i : v) is>>i; return is; } template ostream &operator<<(ostream &os, const vector &v) { for (auto it=v.begin(); it!=v.end(); ++it) { os<<(it==v.begin()?"":" ")<<*it; } return os; } template void co(Head&& head, Tail&&... tail) { if constexpr(sizeof...(tail)==0) cout<(tail)...); } template void ce(Head&& head, Tail&&... tail) { if constexpr(sizeof...(tail)==0) cerr<(tail)...); } template auto make_vector(T x, int arg, Args ...args) { if constexpr(sizeof...(args)==0) return vector(arg, x); else return vector(arg,make_vector(x, args...)); } void sonic() { ios::sync_with_stdio(false); cin.tie(nullptr); } void setp(const int n) { cout << fixed << setprecision(n); } constexpr int64_t INF = 1000000000000000003; constexpr int Inf = 1000000003; constexpr int MOD = 1000000007; constexpr int MOD_N = 998244353; constexpr double EPS = 1e-7; const double PI = acos(-1); // clang-format on int main(void) { int t; cin>>t; rep(_, t) { ll x; cin >> x; if (x % 2) { co(x * 2); } else if (x % 3) { co(x * 3); } else { co(x * 4); } } return 0; }