#include <bits/stdc++.h>
int main(void) {
  int n, k, i, cou = 0, tmp, min = 9, a[5], b, c, d, e;
  for (i = 0; i < 5; i++) {
    scanf(" %d", &a[i]);
    if (min > a[i] % 10 && a[i] % 10 != 0) min = a[i] % 10;
    cou += (a[i] - 1) / 10 * 10 + 10;
  }
  printf("%d", cou - 10 + min);
}
