#include <bits/stdc++.h>
using namespace std;


int main(){
  int sum=0;
  int sasum=0;
  int max=0;
  for(int i=0;i<5;i++){
   int time;
    cin>>time;
       sum+=time;
    
    int sa=0;
   if(time%10!=0) sa=10-time%10;
 
    sasum+=sa;
    if(sa>max)max=sa;
    
  }
  cout<<sum+sasum-max<<endl;
  
}