#include <bits/stdc++.h>
int main(void) {
  int hoge[5], i, j, sum[5], boke, aho, time;
  time = 0;
  for (i = 0; i < 5; i++) {
    scanf("%d", &hoge[i]);
  }
  for (i = 0; i < 5; i++) {
    sum[i] = hoge[i] % 10;
  }
  for (i = 0; i < 4; i++) {
    for (j = i + 1; j < 5; j++) {
      if (sum[i] < sum[j]) {
        aho = sum[i];
        sum[i] = sum[j];
        sum[j] = aho;
        boke = hoge[i];
        hoge[i] = hoge[j];
        hoge[j] = boke;
      }
    }
  }
  for (i = 0; i < 5; i++) {
    time = time + hoge[i];
    if (i < 4) {
      for (j = 0; j < 9; j++) {
        if (time % 10 != 0) {
          time++;
        }
      }
    }
  }
  printf("%d\n", time);
  return 0;
}
