#include <iostream>

int main(){
  int now = 0;
  for(int i = 0; i < 4; i++){
    int time;
    cin >> time;
    
    now += ceil(time / 10) * 10;
  }
  int now;
  cin >> now;
  
  time += now;
  
  cout << time << endl;
}