#inclide <stdio.h>

int main(){
  int a,b,c,d,e;
  scanf(%d\n%d\n%d\n%d\n%d,&a,&b,&c,&d,&e);
  
  int max = 0;
  if((a%10) > (b%10){ max = a%10;}
  else{max = b%10;}
  if((c%10) > max){ max = c%10; }
  if((d%10) > max){ max = d%10; }
  if((e%10) > max){max = e%10;}
  int ia,ib,ic,id,ie;
  ia = a - (a%10) + 10;
  ib = b - (b%10) + 10;
  ic = c - (c%10) + 10;
  id = d - (d%10) + 10;
  ie = e - (e%10) + 10;
  
  printf("%d",ia+ib+ic+id+ie+max);
     }
  
}