#include <bits/stdc++.h>
using namespace std;
int main() {
  int tim[5];
  cin >> tim[0] >> tim[1] >> tim[2] >> tim[3] >> tim[4];
  int sum[5] = {};
  int i, j;
  int flag[5] = {0, 0, 0, 0, 0};
  int timup[5];
  for (i = 0; i < 5; i++) {
    if (tim[i] % 10 > 0) {
      timup[i] = (tim[i] / 10) * 10 + 10;
    } else {
      timup[i] = tim[i];
    }
  }
  sum[0] = timup[0] + timup[1] + timup[2] + timup[3] + tim[4];
  sum[1] = timup[0] + timup[1] + timup[2] + timup[4] + tim[3];
  sum[2] = timup[0] + timup[1] + timup[4] + timup[3] + tim[2];
  sum[3] = timup[0] + timup[4] + timup[2] + timup[3] + tim[1];
  sum[4] = timup[4] + timup[1] + timup[2] + timup[3] + tim[0];
  sort(sum, sum + 4);
  cout << sum[0];
  return 0;
}
