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