#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  vector<int> b(5);
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      b[i] = 10;
    } else {
      b[i] = a[i] % 10;
    }
  }
  vector<int>::iterator iter = min_element(b.begin(), b.end());
  size_t index = distance(b.begin(), iter);
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == index || a[i] % 10 == 0) {
      ans += a[i];
    } else {
      ans += (a[i] / 10) * 10 + 10;
    }
  }
  cout << ans << endl;
  return 0;
}
