#include<stdio.h>

int main(){
  int sum,max;
  int dish[5];
  int dishes[5];
  for(int i = 0; i<5; i++){
    scanf("%d", &dish[i]);
    dishes[i] = dish[i] /10;
  }
  for(int j = 0; j<5; j++){
    if(dishes[j] == 0){
    sum += dish[j];
    dishes[j] += 10;
    }
    else if (dishes[j] < dishes[j+1]){
     int temp = dishes[j]
     dishes[j] = dishes[j+1];
     dishes[j+1] = temp;
    
    }
    int max += dishes[j]
  }
  
  printf("%d", sum - max +40);
  return 0;
}