#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e, k, r;
  k = 0;
  scanf("%d\n%d\n%d\n%d\n%d", &a, &b, &c, &d, &e);
  if (a % 10 != 0) {
    k = a % 10;
    a = ((int)(a / 10)) * 10 + 10;
  }
  if (b % 10 != 0) {
    if (k > (b % 10)) k = b % 10;
    b = b / 10;
    b = b * 10 + 10;
  }
  if (c % 10 != 0) {
    if (k > (c % 10)) k = c % 10;
    c = ((int)(c / 10)) * 10 + 10;
  }
  if (d % 10 != 0) {
    if (k > (d % 10)) k = d % 10;
    d = ((int)(d / 10)) * 10 + 10;
  }
  if (e % 10 != 0) {
    if (k > (e % 10)) k = e % 10;
    e = ((int)(e / 10)) * 10 + 10;
  }
  r = a + b + c + d + e + k - 10;
  printf("%d", r);
  return 0;
}
