#include <bits/stdc++.h>
using namespace std;
std::uint64_t ceil(std::uint64_t n) {
  if (n % 10 == 0) {
    return n;
  } else {
    return (n / 10 + 1) * 10;
  }
}
std::uint64_t f(std::uint64_t n) {
  if (ceil(n) == n) {
    return 10;
  } else {
    return n + 10 - ceil(n);
  }
}
int main(int argc, const char* argv[]) {
  std::uint64_t a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  std::uint64_t ret = ceil(a) + ceil(b) + ceil(c) + ceil(d) + ceil(e);
  std::uint64_t aaa = min({f(a), f(b), f(c), f(d), f(e)});
  if (aaa == 10) {
    cout << ret - 10 << endl;
  } else {
    cout << ret - 10 + aaa << endl;
  }
  return 0;
}
