#pragma warning(disable:4996)
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
bool cmp(int a, int b)
{
return a < b;
}
int main()
{
int n;
scanf("%d", &n);
int a5[1010];
int a1p = 0, a2p=0,a2pp = 1, a3p = 0, a4p = 0, a5p = 0;
int a1sum = 0, a2sum = 0, a4sum = 0;
for (int i = 0; i < n; i++)
{
int temp;
scanf("%d", &temp);
if (temp % 5 == 0)
{
if (temp % 2 == 0)
{
a1sum = a1sum + temp;
a1p++;
}
}
else if (temp % 5 == 1)
{
a2sum = a2sum + a2pp * temp;
a2pp = -1 * a2pp;
a2p++;
}
else if (temp % 5 == 2)
{
a3p++;
}
else if (temp % 5 == 3)
{
a4sum = a4sum + temp;
a4p++;
}
else if (temp % 5 == 4)
{
a5[a5p] = temp;
a5p++;
}
}
if (a5p != 0)
{
sort(a5, a5 + a5p-1, cmp);
}
if (a1p == 0)
printf("N ");
else
printf("%d ",a1sum);
if (a2p == 0)
printf("N ");
else
printf("%d ", a2sum);
if (a3p == 0)
printf("N ");
else
printf("%d ", a3p);
if (a4p == 0)
printf("N ");
else
printf("%.1f ", (float)a4sum/a4p);
if (a5p == 0)
printf("N");
else
printf("%d", a5[a5p - 1]);
}