#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int time = 0;
  int min = 100;
  std::vector<int> v(5);
  std::vector<int> x(5);
  std::vector<int> rm(5);
  for (int i = 0; i < 5; ++i) {
    cin >> v[i];
    x[i] = v[i];
    x[i] /= 10;
    x[i] = int(x[i]);
    x[i] *= 10;
    rm[i] = v[i] - x[i];
    if (min > rm[i] && rm[i] != 0) min = rm[i];
    if (v[i] % 10 == 0) x[i] -= 10;
  }
  for (int i = 0; i < 4; ++i) {
    time += x[i];
    time += 10;
  }
  time += x[4];
  time += min;
  std::cout << time << endl;
  return 0;
}
