import java.io.File;
import java.io.PrintWriter;
import java.util.Scanner;

import static java.lang.Math.abs;

public class Main {
    private static final int MAX = 100;

    public static void main(String[] arguments) throws Exception {
        new Main().run();
    }

    private void run() throws Exception {
        Scanner scanner = new Scanner(new File("Input.txt"));
        PrintWriter printWriter = new PrintWriter(new File("Output.txt"));

        int n = scanner.nextInt();
        int[] numbers = new int[n];
        int p = 0, k = 1;

        scanner.nextLine();

        for (int i = 0; i < n; i++) {
            numbers[i] = scanner.nextInt();
        }

        scanner.close();

        for (int m : numbers) {
            if (abs(m) > MAX) {
                printWriter.close();

                throw new Exception("The numbers must be equal or less than " + MAX);
            }

            if (m > 0) {
                p += m;
            }
        }

        int i1 = findIndexOfMinElement(numbers);
        int i2 = findIndexOfMaxElement(numbers);

        if (i1 > i2) {
            for (int i = i2 + 1; i < i1; i++) {
                k *= numbers[i];
            }
        } else {
            for (int i = i1 + 1; i < i2; i++) {
                k *= numbers[i];
            }
        }

        printWriter.println(p + " " + k);
        printWriter.close();
    }

    private int findIndexOfMaxElement(int a[]) {
        int max = a[0];
        int index = 0;

        for (int i = 0; i < a.length; i++) {
            if (a[i] > max) {
                max = a[i];
                index = i;
            }
        }

        return index;
    }

    private int findIndexOfMinElement(int a[]) {
        int min = a[0];
        int index = 0;

        for (int i = 0; i < a.length; i++) {
            if (a[i] < min) {
                min = a[i];
                index = i;
            }
        }

        return index;
    }
}
