#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <typename T>
T finder(vector<T> vec, T number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  vector<int> A(5);
  vector<int> a(5);
  int ans = 0;
  cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
  a[0] = A[0] % 10;
  a[1] = A[1] % 10;
  a[2] = A[2] % 10;
  a[3] = A[3] % 10;
  a[4] = A[4] % 10;
  sort(a.begin(), a.end());
  int t = -1;
  bool ok = false;
  for (int i = 0; i < 5; i++) {
    if (a[i] == 0)
      ans += A[i];
    else {
      ok = true;
      if (t == -1) {
        if (ok) t = i;
      }
      ans += (A[i] / 10 + 1) * 10;
    }
  }
  if (t > -1) ans -= (10 - a[t]);
  cout << ans << endl;
}
