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