#include <iostrewm>
#include <algorithm>
using namespace std;
int main(void){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  
  int at,bt,ct,dt,et;
  at = (a+9)/10*10;
  bt = (b+9)/10*10;
  ct = (c+9)/10*10;
  dt = (d+9)/10*10;
  et = (e+9)/10*10;
  
  cout << at+bt+ct+dt+et-10+min{(a%10,b%10,c%10,d%10,e%10)} << endl;
  
  return 0;
}
  