#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  vector<int> v = {A, B, C, D, E};
  for (int i = 0; i < (5); i++) v.at(i) %= 10;
  sort(v.begin(), v.end());
  int a;
  for (int i = 0; i < (5); i++) {
    if (v.at(i) != 0) {
      a = v.at(i);
      break;
    }
  }
  if (A % 10 != 0) A = (A / 10 + 1) * 10;
  if (B % 10 != 0) B = (B / 10 + 1) * 10;
  if (C % 10 != 0) C = (C / 10 + 1) * 10;
  if (D % 10 != 0) D = (D / 10 + 1) * 10;
  if (E % 10 != 0) E = (E / 10 + 1) * 10;
  int counter = A + B + C + D + E;
  cout << counter - 10 + a << endl;
}
