#include <bits/stdc++.h>
int main(void) {
  int t[5];
  int a[5];
  int x = 0;
  int a_max = 9;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &t[i]);
    a[i] = t[i] % 10;
    if (a[i] == 0) continue;
    int tmp = a[i];
    if (tmp < a_max) {
      x = i;
      a_max = tmp;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == x) continue;
    if (a[i] != 0)
      ans = ans + t[i] + abs((a[i] - 10));
    else
      ans = ans + t[i];
  }
  ans = ans + t[x];
  printf("%d", ans);
  return 0;
}
