#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>  
#include <queue>
#include <iostream>
#include <climits> 
#include <cassert> 

using namespace std;

int n;
long long maxS = 0;
long long minS = LLONG_MAX;
long long a[7];

void f(int cur, long long sum1, long long sum2)
{
	if (cur == n)
	{
	    long long s = sum1 * sum2;
	    
	    if (s == 0) return;
	    
		if (maxS < s)
			maxS = s;
			
	    if (minS > s)
			minS = s;

		return;
	}
	f(cur + 1, sum1 + a[cur], sum2);
	f(cur + 1, sum1, sum2 + a[cur]);
}

int main()
{
	cin >> n;
	
	assert(2 <= n && n <= 7);
	
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		assert(1 <= a[i] && a[i] <= 100000000);
	}

	f(0, 0, 0);

	cout << minS << ' ' << maxS << endl;

	return 0;
}