B - Memorial


  • محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

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×11 \times 1. We intend to select a rectangle of size a×ba \times b on the wall with a.ba.b tiles and inscribe the professors' names on them.

The university will approve this request if the following conditions are met:

  1. First, the names of nn faculty members of the Computer Engineering Department must be included in this tribute.
  2. Second, the perimeter of this rectangle, that is, 2a+2b2a + 2b, must be minimized.
  3. Third, the values of aa and bb must be prime numbers.

Given a natural number nn, you are asked to calculate the minimum possible perimeter for this tribute.

ورودی🔗

The first line of input contains a positive integer tt, representing the number of test cases.

1t1001 \leq t \leq 100

In the next tt lines, each line contains an integer nn, representing the number of professors for that test case.

1n1091 \leq n \leq 10^9

خروجی🔗

For each of the tt test cases, print a natural number representing the minimum required perimeter.

مثال‌ها🔗

ورودی نمونه ۱🔗

3
1
17
10
Plain text

خروجی نمونه ۱🔗

8
20
14
Plain text
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.