#include <iostream>
using namespace std;

#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  int t,acc,x;

  acc = x = 0;
  for (int i=0; i<5; i++){
    cin >> t;
    x = MAX(x, (10-t%10)%10);
    acc += (t+9)/10*10;
  }
  cout << (acc-x) << endl;
  return 0;
}
  