#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5][2], tmp[2] = {0};
  bool flag = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i][0];
    a[i][1] = a[i][0] % 10;
    a[i][0] -= a[i][1];
  }
  for (int i = 1; i < 9; i++) {
    for (int j = 0; j < 5; j++) {
      if (a[j][1] == i) {
        tmp[1] = j;
        flag = 1;
        break;
      }
    }
    if (flag == 1) break;
  }
  for (int i = 0; i < 5; i++) {
    tmp[0] += a[i][0];
    if (a[i][1] != 0) {
      tmp[0] += 10;
    }
  }
  if (flag == 0) {
    printf("%d", tmp[0]);
  } else {
    printf("%d", tmp[0] - 10 + a[tmp[1]][1]);
  }
  return 0;
}
