#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,sum(0),max(0);
int one[20]={97, 92, 0, 0, 89, 82, 0, 0, 0, 95, 0, 0, 94, 0, 0, 0, 98, 93, 0, 0};
int two[20]= {90, 85, 0, 0, 83, 86, 0, 97, 0, 99, 0, 0, 91, 83, 0, 0, 83, 87, 0, 99};
int three[20]= {0, 96, 0, 0, 97, 0, 0, 96, 89, 0, 96, 0, 0, 87, 98, 0, 99, 92, 0, 96};
int four[20]= {0, 0, 0, 80, 0, 0, 87, 0, 0, 0, 97, 93, 0, 0, 97, 93, 98, 96, 89, 95};
int five[20]= {0, 0, 93, 86, 0, 0, 90, 0, 0, 0, 0, 98, 0, 0, 98, 86, 81, 98, 92, 81};
for(a=0;a<20;a++){
for(b=0;b<20;b++){
for(c=0;c<20;c++){
for(d=0;d<20;d++){
for(e=0;e<20;e++){
if(a!=b&&a!=c&&a!=d&&a!=e&&b!=c&&b!=d&&b!=e&&c!=d&&c!=e&&d!=e){
sum=one[a]+two[b]+three[c]+four[d]+five[e];
if(max<sum)max=sum;
}
}
}
}
}
}
cout<<max;
}