#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  vector<int> b(5);
  int cnt = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    cnt += (a[i] + 9) / 10 * 10;
  }
  for (int i = 0; i < 5; i++) {
    b[i] = a[i] % 10;
  }
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  cout << cnt - b[0] << endl;
}
