#include <iostream>
#include <algorithm>
using namespace std;

int main () {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int N = 5;
  
  vector<int> Time = [a, b, c, d, e];
  vector<int> nextTime(N);
  for (int i = 0; i < N; i++) {
    nextTime[i] = (Time[i] + 9) / 10 * 10;
  }
  
  int BestTime = 9999999999;
  
  for (int i = 0; i < N; i++) {
    int Sumtime = 0;
    for (int j = 0; j < N; j++){
      if (i == j) {
        SumTime += nextTime[j];
      }else {
        SumTime += nextTime[j];
      }
    }
    BestTime = min(BestTime, SumTime);
  }
  cout << BestTime << endl;