#include <iostream>
using namespace std;

int main(void){
  int time = 0, menu, x = 0;
  for(int i = 0; i < 5; i++){
    cin >> menu;
    if(menu%10 == 0) time += menu;
    else time += (menu+9)/10*10; // Round up
    if(x < (10-menu%10)%10) x = (10-menu%10)%10;
  }
  cout << time-x << endl;
  return 0;
}
