Yash likes playing with numbers. He has a challenge for you. Yash gives
you a number that he made by multiplying two numbers. He claims that the
possible sum of the two numbers he multiplied is as minimum as possible. He
challenges you to find that minimum sum.
Formally, for a given value of N, you are required to find the minimum sum of two distinct numbers x and y such that x, y > 0 and xy = N.  
-----Input:-----
The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
Each testcase contains single integer N.
-----Output:-----
For each testcase, output minimum x + y such that x*y = N and x,y >0.
-----Constraints :-----
$1 \leq T \leq 100$
$1 < N \leq 10^{12}$
-----Sample Input:-----
1
852140
-----Sample Output:-----
1929
# cook your dish here
def isPrime(n) : 
  
    # Corner cases 
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
  
    # This is checked so that we can skip  
    # middle five numbers in below loop 
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True
t=int(input())
for i in range(0,t):
    n=int(input())
    if n==1:
        print("2")
        continue
    if isPrime(n):
        print(n+1)
        continue
    if n%2==0:
        k=n//2
        min=2+k
    else:
        min=n+1
    for j in range(2,(n//2)+1):
        if n%j==0:
            k=n//j
            if k!=j:
                l=j+k
                if l<min:
                    min=l
    print(min)

# cook your dish here
def isPrime(n) : 
  
    # Corner cases 
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
  
    # This is checked so that we can skip  
    # middle five numbers in below loop 
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True
t=int(input())
for i in range(0,t):
    n=int(input())
    if n==1:
        print("2")
        continue
    if isPrime(n):
        print(n+1)
        continue
    if n%2==0:
        k=n//2
        min=2+k
    else:
        min=n+1
    for j in range(2,(n//2)+1):
        if n%j==0:
            k=n//j
            if k!=j:
                l=j+k
                if l<min:
                    min=l
    print(min)
