#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], k;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  int min{9};
  int mini;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 > 0 && a[i] % 10 < min) {
      min = a[i] % 10;
      mini = i;
    }
    a[i] = (a[i] % 10) ? (a[i] / 10 + 1) * 10 : a[i];
  }
  int sum{};
  for (int i = 0; i < 5; i++) {
    sum += a[i];
  }
  sum -= 10;
  sum += min;
  printf("%d\n", sum);
  return 0;
}
