#include<iostream>
#include<string>
#include <iomanip>
#include<sstream>
using namespace std;
int main()
{
int noUse = 0;
cin >> noUse;
string s;
getline(cin, s);
int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0;
int t, num1 = 0, num2 = 0, tag2 = 0, num3 = 0, max5 = 0;
double sum4 = 0.0, num4 = 0.0, aver4 = 0.0;
for (istringstream sin(s); sin >> t;) {
if (t % 5 == 0 && t % 2 == 0) {
num1 += t;
a1++;
}
if (t % 5 == 1) {
if (tag2 == 0) {
num2 += t;
tag2 = 1;
continue;
}
if (tag2 == 1) {
num2 -= t;
tag2 = 0;
}
a2++;
}
if (t % 5 == 2) {
num3++;
a3++;
}
if (t % 5 == 3) {
num4++;
sum4 += t;
a4++;
}
if (t % 5 == 4) {
if (t > max5) {
max5 = t;
}
a5++;
}
}
aver4 = sum4 / num4;
if (a1 == 0) {
cout << "N" << " ";
}
else {
cout << num1 << " ";
}
if (a2 == 0) {
cout << "N" << " ";
}
else {
cout << num2 << " ";
}
if (a3 == 0) {
cout << "N" << " ";
}
else {
cout << num3 << " ";
}
if (a4 == 0) {
cout << "N" << " ";
}
else {
cout << fixed << setprecision(1) << aver4 << " ";
}
if (a5 == 0) {
cout << "N";
}
else {
cout << max5;
}
return 0;
}