#include <iostream>                                                                                                     using namespace std;

int main(){
  int input[5], max = 0, maxi = 0, tmp[5];
  int sum = 0;
  for(int i = 0; i < 5; i++){
    cin >> input[i];
    tmp[i] = (input[i] % 10 == 0) ? 0 : 10 - input[i] % 10;
    if(max < tmp[i]){
      max = tmp[i];
      maxi = i;
    }
  }

  for(int i = 0; i < 5; i++){
    sum += input[i];
    if(i != maxi){
      sum += tmp[i];
    }
  }

  cout << sum << endl;

  return 0;
}