#include <bits/stdc++.h>
using namespace std;
bool cmp(const int a, const int b) { return ((a % 10) > (b % 10)); }
void swap(int *a, int *b) {
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}
int main() {
  int sum = 0, x;
  vector<int> v;
  for (int i = 0; i < 5; ++i) {
    cin >> x;
    if (x % 10 == 0)
      sum += x;
    else
      v.push_back(x);
  }
  int n = v.size();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n - i - 1; ++j) {
      if ((v[j + 1] % 10) > (v[j] % 10)) swap(&v[j], &v[j + 1]);
    }
  }
  for (int i = 0; i < n - 1; ++i) {
    sum += (v[i] + (10 - (v[i] % 10)));
  }
  sum += v[n - 1];
  cout << sum << '\n';
  return 0;
}
