import java.util.Arrays;
import java.math.BigInteger;

public class Solution {
    public static String solution(int[] xs) {
        //assume xs never drops below 1 element as stated in the constraint

        int negCount = 0, remove = -1; 
        
        Arrays.sort(xs);
        
        for(int i = 0; i < xs.length; i++) {
            int x = xs[i];
            
            if(x < 0) {
                negCount++;
                remove = i;  //get last negative value's index to be removed
            }
        }

        if(xs.length > 1 && remove != -1 && negCount % 2 != 0) xs[remove] = 0;  //if a remove value is found and it's not the only value, and negative count is not even (multiplying will return negative)
        
        BigInteger result = BigInteger.ZERO;  //initialize big integer since it can get pretty big according to the readme
        
        for(int x : xs) {
            if(x != 0)
                result = result == BigInteger.ZERO ? BigInteger.valueOf(x) : result.multiply(BigInteger.valueOf(x));  //only multiply non zero values; zero values are almost always discardable
        }
        
        return result.max(BigInteger.valueOf(xs[xs.length - 1])).toString();  //check if result is smaller than largest value in array (usually for catching 0s that we discarded)
    }
}