#include<iostream>
#include<string>
using namespace std;

int main(){
  int a[5];
  int total = 0;
  int res = 10;
  for (int i=0;i<5;i++){
    cin >> a[i];
    total += (((a[i]-1)/10)+1) * 10;
    res = min((a[i]-1)%10,res);
  }
  total -= (9 - res);
  cout << total << endl;
  return 0;
}
