#include <bits/stdc++.h>
int main() {
  int a[5];
  scanf("%d", &a[0]);
  scanf("%d", &a[1]);
  scanf("%d", &a[2]);
  scanf("%d", &a[3]);
  scanf("%d", &a[4]);
  int x;
  int b;
  for (x = 0; x < 5; x++) {
    if (x == 0) {
      b = a[0] % 10;
    } else if ((a[x] - 1) % 10 < b - 1)
      b = a[x] % 10;
    if ((a[x] % 10) != 0) a[x] = a[x] + 10 - (a[x] % 10);
  }
  printf("%d", a[0] + a[1] + a[2] + a[3] + a[4] - 10 + b);
  return 0;
}
