#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> v(5), b(5);
  for (long long i = 0; i < 5; i++) {
    cin >> v.at(i);
    b.at(i) = v.at(i) % 10;
  }
  long long x;
  sort(b.begin(), b.end());
  for (long long i = 0; i < 5; i++) {
    if (b.at(i) != 0) {
      x = b.at(i);
      break;
    }
  }
  for (long long i = 0; i < 5; i++) {
    if (v.at(i) % 10 != 0) {
      long long a = v.at(i) / 10;
      v.at(i) = 10 * (a + 1);
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 5; i++) {
    ans += v.at(i);
  }
  cout << ans - 10 + x;
}
