#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d, e;
  int duration[5];
  int i;
  for (i = 0; i < 5; i++) scanf("%d", duration[i]);
  int idxMinMod = 0;
  int minMod = duration[0] % 10;
  for (i = 1; i < 5; i++) {
    int mod = duration[i] % 10;
    if (mod > 0 && mod < minMod) {
      idxMinMod = i;
      minMod = mod;
    }
  }
  int totalDuration = 0;
  for (i = 0; i < 5; i++) {
    if (i == idxMinMod) {
      totalDuration += duration[i];
    } else {
      totalDuration += (duration[i] / 10) * 10;
      if (duration[i] % 10 != 0) {
        totalDuration += 10;
      }
    }
  }
  printf("%d\n", totalDuration);
  fflush(stdout);
  return 0;
}
