A = int(input())

min_nm = float('inf')

# Consider M from 1 to 100 to cover larger values that might yield smaller products
for M in range(1, 101):
    # Determine the minimum N such that N^M >= A using binary search
    left, right = 1, 1
    # Expand right until right^M >= A
    while True:
        current = pow(right, M)
        if current < A:
            left = right
            right *= 2
        else:
            break
    
    # Binary search between left and right to find the smallest N
    low, high = left, right
    answer = right
    while low <= high:
        mid = (low + high) // 2
        val = pow(mid, M)
        if val >= A:
            answer = mid
            high = mid - 1
        else:
            low = mid + 1
    
    nm = answer * M
    if nm < min_nm:
        min_nm = nm

print(min_nm)