#include <bits/stdc++.h>
using namespace std;
bool cmp(const int a, const int b) { return ((a % 10) > (b % 10)); }
void swap(int *a, int *b) {
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}
int main() {
  int sum = 0, x, small;
  vector<int> v;
  small = 9;
  for (int i = 0; i < 5; ++i) {
    cin >> x;
    if (x % 10 == 0)
      sum += x;
    else {
      v.push_back(x);
      small = (x % 10 < small % 10) ? x : small;
    }
  }
  int n = v.size();
  for (int i = 0; i < n; ++i) {
    if (v[i] == small) continue;
    sum += (v[i] + (10 - (v[i] % 10)));
  }
  sum += small;
  cout << sum << '\n';
  return 0;
}
