#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> v(5);
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0)
      v[i] = 0;
    else
      v[i] = (10 - a[i] % 10);
  }
  int mx = 0;
  for (int i = 0; i < 5; i++) {
    if (v[i] > mx) mx = v[i];
  }
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    if (v[i] == 0 || v[i] == mx)
      sum += a[i];
    else
      sum += a[i] + v[i];
  }
  cout << sum;
  cout << endl;
  return 0;
}
