#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
  }
  int last = min({a[0] % 10 + 1, a[1] % 10 + 1, a[2] % 10 + 1, a[3] % 10 + 1,
                  a[4] % 10 + 1});
  int l = 0;
  for (int i = 0; i < 5; ++i) {
    if (last == a[i] % 10 + 1) {
      l = i;
    }
  }
  int res = 0;
  for (int i = 0; i < 5; ++i) {
    if (i != l) {
      res += a[i] + (10 - a[i] % 10);
    } else {
      res += a[i];
    }
  }
  cout << res << endl;
}
