#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5], i;
  for (signed i = 0; i < 5; i++) cin >> a[i];
  int b[5];
  for (signed i = 0; i < 5; i++) b[i] = a[i] % 10;
  sort(b, b + 5);
  int r = 0;
  for (signed i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) a[i] -= 10;
    r += 10 * (a[i] / 10 + 1);
  }
  i = 0;
  while (1) {
    if (b[i] != 0) break;
    i++;
    if (i == 5) {
      i = 0;
      break;
    }
  }
  r = r - 10 + b[i];
  cout << r << endl;
}
