#include <bits/stdc++.h>
using namespace std;
int a[6];
int main() {
  for (int i = 1; i <= 5; i++) scanf("%d", &a[i]);
  int sum = 0;
  for (int i = 1; i <= 5; i++)
    if (a[i] % 10 != 0)
      sum += a[i] + 10 - a[i] % 10;
    else
      sum += a[i];
  for (int i = 1; i <= 5; i++) a[i] = a[i] % 10;
  sort(a + 1, a + 1 + 5);
  int j = 1;
  while (a[j] == 0 && j < 5) j++;
  sum -= 10 - a[j];
  printf("%d\n", sum);
  return 0;
}
