#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }
  reverse(A.begin(), A.end());
  for (ll i = 0; i < N; i++)
  {
    cin >> B.at(i);
  }

  priority_queue<ll, vector<ll>, greater<ll>> pque;
  ll AokiSum = 0;
  for (ll i = 0; i < N; i++)
  {
    pque.push(A.at(i));
    pque.push(B.at(i));

    AokiSum += pque.top();
    pque.pop();
  }

  ll S = accumulate(A.begin(), A.end(), 0LL) + accumulate(B.begin(), B.end(), 0LL);
  ll ans = S - AokiSum;
  cout << ans << endl;
}


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

using   ll  =       long long int;
using   pll =       pair<ll, ll>;
using   vll =       vector<ll>;
#define endl        "\n"
#define space       " "
#define TLE_na_ho   ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MAX_SIZE    1024
#define MOD         1000000007
#define pb          push_back
#define ff          first
#define ss          second
#define all(v)      v.begin(),v.end()
#define f(n)        for(ll i=0;i<n;i++)
#define rep(i,a,n)  for(ll i=a;i<n;i++)
#define repe(i,a,n) for(ll i=a;i<=n;i++)
#define repr(i,a,n) for(ll i=a;i>=n;i--)
#define ain(arr,n)  for(ll i1=0;i1<n;i1++ ) cin>>arr[i1]
#define aout(arr,n) for(ll i1=0;i1<n;i1++ ) cout<<arr[i1]<<space

ll testcases;

int main()
{
    TLE_na_ho;
    //READ THE QUESTION PROPERLY!!
    testcases = 1;
    //cin>>testcases;
    while(testcases--)
    {
        ll n;
        cin >> n;
        ll a[n];
        ll md = 0, cd = 0;
        double ed = 0;
        f(n)
        {
            cin >> a[i];
            md += abs(a[i]);
            cd = max(cd, abs(a[i]));
            ed += a[i] * a[i];
        }
        cout << fixed << setprecision(9) << md << endl << sqrt(ed) << endl << cd << endl;

    }

}
