#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
#include <stdio.h>
int main(void) {
    ll n,i,c=0,d=0,ma,min;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        c+=abs(a[i]);
        d+=a[i]*a[i];
    }
    ma=*max_element(a,a+n);
    min=*min_element(a,a+n);
    cout<<c<<"\n"<< fixed << setprecision(15) << sqrt(d)<<"\n"<<max(ma,-1*min);
    
	return 0;
}





//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#include<string.h>
using namespace std;
#define pb          push_back
#define all(v)      v.begin(),v.end()
#define ya          cout<<"YES"<<endl;
#define no          cout<<"NO"<<endl;
#define ff          first
#define sc          second
#define inf         999999999
#define pi          3.14159265359
#define printv(v)   for(auto x:v)cout<<x<<' ';cout<<endl;
#define takev(v)    for(auto &x:v)cin>>x;
inline  int         random(int a=1,int b=10)
{
    return a+rand()%(b-a+1);
}
typedef long long ll;
inline ll           lcm(ll a,ll b)
{
    return (a*b)/__gcd(a,b);
}
//#define see(x)  cout<<endl<<#x<<" : "<<(x)<<endl;
#define see(args...) \
{ \
    string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');\
    stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);\
}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr<< *it << " = " << a <<",\n"[++it==istream_iterator<string>()];
    err(it, args...);
}

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int N=2e5+9,mod=998244353;


int main()
{
//    ios::sync_with_stdio(0);
//    cin.tie(NULL);
//    cout.tie(NULL);

    ll n,i,j,k,ans=0,tot=0,ta=0,ao=0,win=0;
    string s,t;
    cin>>k;
    cin>>s>>t;
    vector<ll>ft(11),fa(11),have(11,k);

    for(int i=0;i<4;i++)ft[s[i]-'0']++,have[s[i]-'0']--;
    for(int i=0;i<4;i++)fa[t[i]-'0']++,have[t[i]-'0']--;

    for(i=1;i<=9;i++)
    {
        ta += i*pow(10,ft[i]);
        ao += i*pow(10,fa[i]);
    }

    tot = k*9 - 8;
    tot *= tot-1;

    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            ft[i]++;
            fa[j]++;

            ll taka = ta - i*pow(10,ft[i]-1);
            taka += i*pow(10,ft[i]);

            ll aoki = ao - j*pow(10,fa[j]-1);
            aoki += j*pow(10,fa[j]);

            ft[i]--;
            fa[j]--;

            if(taka > aoki)
            {
                if(i==j)
                win += have[i]*(have[j]-1);
                else
                win += (have[i]*have[j]);
            }

        }
    }

    printf("%.10lf\n",win/(tot*1.0));

    return 0;
}

