#include <bits/stdc++.h>
using namespace std;
int roundup(int a) {
  int result = (a + (10 - a % 10));
  return result;
}
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int result = 0;
  int tmp = 0;
  for (int i = 0; i < 5; i++) {
    tmp = max(tmp, a[i] % 10);
    result += roundup(a[i]);
  }
  cout << result - tmp << endl;
  ;
}
