#include <stdio.h>
int amari(int x){
  return x % 10; 
}
 
int min(int x[5]){
  int min = x[0];
  int i, count = 0;
  for(i=1;i<5;i++){
    if(x[i] == 0){
      
      continue;
    }
    else if(min > x[i]) {
      min = x[i]; count=i;
    }
  }
  return count;
}
 
int main(void){
  int A, B, C, D, E, k, l=0;
  int a[5], i;
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  scanf("%d",&D);
  scanf("%d",&E);
  a[0] = amari(A);
  a[1] = amari(B);
  a[2] = amari(C);
  a[3] = amari(D);
  a[4] = amari(E);
  k = min(a);
  for(i=0;i<5;i++){
   if(a[i] == 0) l++;
  }
  if(l = 5) l -= 1;
  if(k == 0) {
    printf("%d",A+B+C+D+E+40-l*10-a[1]-a[2]-a[3]-a[4]);
  }
  else if(k == 1) printf("%d",A+B+C+D+E+40-l*10-a[0]-a[2]-a[3]-a[4]);
  else if(k == 2) printf("%d",A+B+C+D+E+40-l*10-a[0]-a[1]-a[3]-a[4]);
  else if(k == 3) printf("%d",A+B+C+D+E+40-l*10-a[0]-a[1]-a[2]-a[4]);
  else printf("%d",A+B+C+D+E+40-l*10-a[0]-a[2]-a[3]-a[1]);
  
  printf("\n");
  return 0;
}
#include <stdio.h>
int amari(int x){
  return x % 10; 
}

int min(int x[5]){
  int min = x[0];
  int i, count = 0;
  for(i=1;i<5;i++){
    if(x[i] == 0){
      
      continue;
    }
    else if(min > x[i]) {
      min = x[i]; count=i;
    }
  }
  return count;
}

int main(void){
  int A, B, C, D, E, k, l=0;
  int a[5], i;
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  scanf("%d",&D);
  scanf("%d",&E);
  a[0] = amari(A);
  a[1] = amari(B);
  a[2] = amari(C);
  a[3] = amari(D);
  a[4] = amari(E);
  k = min(a);
  for(i=0;i<5;i++){
   if(a[i] == 0) l++;
  }
  if(l == 5) l -= 1;
  if(k == 0) {
    printf("%d",A+B+C+D+E+40-l*10-a[1]-a[2]-a[3]-a[4]);
  }
  else if(k == 1) printf("%d",A+B+C+D+E+40-l*10-a[0]-a[2]-a[3]-a[4]);
  else if(k == 2) printf("%d",A+B+C+D+E+40-l*10-a[0]-a[1]-a[3]-a[4]);
  else if(k == 3) printf("%d",A+B+C+D+E+40-l*10-a[0]-a[1]-a[2]-a[4]);
  else printf("%d",A+B+C+D+E+40-l*10-a[0]-a[2]-a[3]-a[1]);
  
  printf("\n");
  return 0;
}