#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  vector<int> v, v2;
  int t, k;
  for (int i = 0; i < 5; ++i) {
    cin >> t;
    v.push_back(t);
    if (t % 10 != 0) v2.push_back(t % 10);
  }
  sort(v2.begin(), v2.end());
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    float temp = (float)v[i] / 10.0;
    sum += ceil(temp) * 10;
  }
  sum += (v2[0] - 10);
  if (sum < 0) sum = 0;
  cout << sum << endl;
  return 0;
}
