#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,C,D,E,a,b,c,d,e,k;
  int i==0;
  cin >>A;
  cin >>B;
  cin >>C;
  cin >>D;
  cin >>E;
  a==A%10;
  b==B%10;
  c==C%10;
  d==D%10;
  e==E%10;
  if(a<=b,a<=c,a<=d,a<=e){
    k==a;
  }
   if(b<=a,b<=c,b<=d,b<=e){
    k==b;
  }
   if(c<=a,c<=b,c<=d,c<=e){
    k==c;
  }
   if(d<=a,d<=b,d<=c,d<=e){
    k==d;
  }
   if(e<=a,e<=b,e<=c,e<=d){
    k==e;
  }
  if(A%10==0){
    i==i+1;
  }
  if(B%10==0){
    i==i+1;
  }
   if(C%10==0){
    i==i+1;
  }
   if(D%10==0){
    i==i+1;
  }
   if(E%10==0){
    i==i+1;
  }
  cout <<A+B+C+D+E+40-a-b-c-d-e-10*i+k<<endl;
}
    
  
  