- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
We want to engrave the names of several distinguished professors on the wall of Amirkabir University. The name of each professor will be written on a tile \(1 \times 1\). We intend to select a rectangle of size \(a \times b\) on the wall with \(a.b\) tiles and inscribe the professors' names on them.
The university will approve this request if the following conditions are met:
- First, the names of \(n\) faculty members of the Computer Engineering Department must be included in this tribute.
- Second, the perimeter of this rectangle, that is, \(2a + 2b\), must be minimized.
- Third, the values of \(a\) and \(b\) must be prime numbers.
Given a natural number \(n\), you are asked to calculate the minimum possible perimeter for this tribute.
ورودی
The first line of input contains a positive integer \(t\), representing the number of test cases.
\[1 \leq t \leq 100\]
In the next \(t\) lines, each line contains an integer \(n\), representing the number of professors for that test case.
\[1 \leq n \leq 10^9\]
خروجی
For each of the \(t\) test cases, print a natural number representing the minimum required perimeter.
مثالها
ورودی نمونه ۱
3
1
17
10
خروجی نمونه ۱
8
20
14
ارسال پاسخ برای این سؤال