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