#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    int f,g,h,i,j;
    f=a%10;
    g=b%10;
    h=c%10;
    i=d%10;
    j=e%10;
    int m=0;

    if(!(f==0)&&!(g==0)m=min(f,g);
    if(!(h==0))m=min(m,h);
    if(!(i==0))m=(m,i);
    if(!(j==0))m=(j,j);
    int sum=a+b+c+d+e+(40-f-g-h-i-j)+m;
    cout<<sum<<endl;

}