#include <bits/stdc++.h>
using namespace std;

int n, a[200010], b[200010];
long long ans = 0;
priority_queue <int, vector <int>, greater <int> > q;

int main() {
	scanf("%d", &n);
	for (int i = n - 1; i >= 0; --i) {
		scanf("%d", &a[i]);
		ans += a[i];
	}
	for (int i = 0; i < n; ++i) {
		int b; scanf("%d", &b);
		q.push(a[i]); q.push(b); ans += b;
		ans -= q.top(); q.pop();
	}
	printf("%lld\n", ans);
	return 0;
}


/**
 *  author: mahfuzz
 *  created: 01.11.2020
**/
 
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    int n; cin >> n;
    ll man = 0, cheb = 0;
    double euclid;

    for(int i = 0; i < n; i++){
        ll x; cin >> x;
        x = abs(x);

        man += x;
        cheb = max(cheb, x);
        euclid += ((x * 1.0) * (x * 1.0));
    }

    cout << man << "\n";
    cout <<fixed << setprecision(10)<< sqrt(euclid) << "\n";
    cout << cheb << "\n";
    
        
    return 0;
}
