#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], j, i;
  for (i = 0; i < 5; i++) cin >> a[i];
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 4; j++) {
      if (a[j] % 10 > a[j + 1] % 10) {
        int temp = a[j];
        a[j] = a[j + 1];
        a[j + 1] = temp;
      }
    }
  }
  int sum = 0, cont = 0;
  for (i = 0; i < 5; i++) sum += a[i];
  for (i = 0; i < 5; i++)
    if (a[i] % 10 == 0) cont++;
  i = 4;
  while (a[i] % 10 != 0 && i > 0) {
    sum += (10 - (a[i] % 10));
    i--;
  }
  if (cont != 0) sum -= (10 - a[i + 1] % 10);
  cout << sum << endl;
  return 0;
}
