#include <bits/stdc++.h>
using namespace std;
int main() {
  int min, mini, resp = 0, cont = 0;
  vector<int> v(5);
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    if (i == 0) {
      min = v[i] % 10;
      mini = 0;
    } else if ((v[i] % 10 < min && v[i] % 10 != 0 && min) || min == 0) {
      min = v[i] % 10;
      mini = i;
    }
    if (v[i] % 10 == 0) cont++;
  }
  for (int i = 0; i < 5; i++) {
    if (i != mini) resp += v[i] + 10 - (v[i] % 10);
  }
  resp += v[mini] - (cont * 10);
  cout << resp << endl;
  return 0;
}
