#include <bits/stdc++.h>
using namespace std;
int main() {
  int time = 0;
  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++) {
    if (Time[i] % 10 == 0)
      nextTime[i] = Time[i];
    else
      nextTime[i] = Time[i] - Time[i] % 10 + 10;
  }
  int bestTime = (int)1e9;
  int sumTime = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j)
        sumTime += Time[i];
      else
        sumTime += nextTime[i];
    }
    bestTime = min(bestTime, sumTime);
  }
  cout << bestTime << endl;
}
