#include<stdio.h>

int main(void){
  
  int time[5],time_quo[5],time_TT[5]; //TT is Total Time
  int i,sub,result = 0;
  
  for(i = 0;i < 5;i++){
    scanf("%d",&time[i]);
    time_quo[i] = time[i] % 10;
    if(time[i] % 10 == 0){
      time_TT[i] = time[i];
    }else{
      time_TT[i] = ((time[i] / 10) + 1) * 10;
    }
  }
  
  for(i = 0;i < 5;i++){
    result += time_TT[i];
  }
  
  sub = time_quo[0];
  for(i = 0;i < 5;i++){
    if(sub > time_quo[i] && time_quo[i] != 0){
      sub = time_quo[i];
    }
  }
  
  if(result == 0){
    printf("0")
  }else{
    printf("%d",result - 10 + sub);
  }
  return 0;
}
