#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E, cnt;
  cnt = 0;
  int d[5];
  int e[5];
  int mi = 9;
  for (int i = 0; i < 5; i++) {
    cin >> d[i];
  }
  for (int i = 0; i < 5; i++) {
    e[i] = d[i] % 10;
    if (e[i] == 0) cnt++;
    if (e[i] != 0) {
      mi = min(mi, e[i]);
    }
  }
  if (mi == e[0]) {
    cout << d[0] + (d[1] / 10) * 10 + 10 + (d[2] / 10) * 10 + 10 +
                (d[3] / 10) * 10 + 10 + (d[4] / 10) * 10 + 10 - cnt * 10
         << endl;
  } else if (mi == e[1]) {
    cout << (d[0] / 10) * 10 + 10 + d[1] + (d[2] / 10) * 10 + 10 +
                (d[3] / 10) * 10 + 10 + (d[4] / 10) * 10 + 10 - cnt * 10
         << endl;
  } else if (mi == e[2]) {
    cout << (d[0] / 10) * 10 + 10 + (d[1] / 10) * 10 + 10 + d[2] +
                (d[3] / 10) * 10 + 10 + (d[4] / 10) * 10 + 10 - cnt * 10
         << endl;
  } else if (mi == e[3]) {
    cout << (d[0] / 10) * 10 + 10 + (d[1] / 10) * 10 + 10 + (d[2] / 10) * 10 +
                10 + d[3] + (d[4] / 10) * 10 + 10 - cnt * 10
         << endl;
  } else if (mi == e[4]) {
    cout << (d[0] / 10) * 10 + 10 + (d[1] / 10) * 10 + 10 + (d[2] / 10) * 10 +
                10 + (d[3] / 10) * 10 + 10 + d[4] - cnt * 10
         << endl;
  }
}
