#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
vector<long long>nums;
long long  sum;
long long min_sub = sum;
void dfs(int index, long long  patial_sum, long long& min_sub) {
    if (sum - patial_sum - patial_sum <= min_sub)  min_sub = sum - patial_sum -
                patial_sum;
    if (min_sub == 0 || min_sub == 1) return;
    if (index == nums.size()) return;
    if (patial_sum + nums[index] <= sum / 2)
        dfs(index + 1, patial_sum + nums[index], min_sub);
    dfs(index + 1, patial_sum, min_sub);
}
//判断是否合法
bool isvalid(string t) {
    for (int i = 0; i < t.length(); i++)
        if (!isdigit(t[i])) return false;
    return true;
}
int main() {
    string s, t;
    while (getline(cin, s)) {
        nums.clear();
        stringstream ss(s);
        //cout<<s;
        bool isinvalid = 0;
        while (ss >> t) {
            if (isvalid(t))  nums.push_back(stod(t));
            else isinvalid = 1;
        }
        if (isinvalid == 1) {
            cout << "ERROR" << endl;
            continue;
        }
        sum = 0;
        for (int i = 0; i < nums.size(); i++) sum += nums[i];
        //只要能从nums数组中挑出一些数,使得这些数之和patial_sum(小的)与sum-patial_sum的差越小越好
        min_sub = sum;//差值
        long long patial_sum = 0;
        dfs(0, 0, min_sub);
        cout << sum - ((sum - min_sub) / 2) << " " << (sum - min_sub) / 2 << endl;
    }
}
// 64 位输出请用 printf("%lld")