#include <bits/stdc++.h>
using namespace std;
vector<int> v;
bool cmp(int a, int b) {
  if (a % 10 != 0) return (a % 10) > (b % 10);
}
int main() {
  int sum = 0, x;
  for (int i = 0; i < 5; ++i) {
    cin >> x;
    if (x % 10 == 0)
      sum += x;
    else
      v.push_back(x);
  }
  sort(v.begin(), v.end(), cmp);
  int len = v.size();
  for (int i = 0; i < len - 1; ++i) {
    sum += (v[i] + (10 - v[i] % 10));
  }
  sum += v[len - 1];
  cout << sum << '\n';
  return 0;
}
