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

int main(){
  
  int x,p=0,min=0;
  
  for(int i = 0;i<5;i++){
    cin >> x;
    p+=x/10;
    if(x%10 != 0) {
      p+=1;
      if(10-x%10>min) min = 10-x%10;
    }
  }
  cout << p*10-min <<endl;
}