#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int c[5];
  int d[5];
  int mind = 0;
  int total = 0;
  int ts;
  bool check = true;
  for (int i = 0; i < 5; i++) {
    cin >> c[i];
    d[i] = c[i] % 10;
    total += ((c[i] - 1) / 10 + 1) * 10;
    mind = *std::min_element(d, d + 5);
  }
  cout << total + mind - 10 << endl;
}
