#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5];
  int sum = 0;
  int min = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 < a[min] % 10) min = i;
  }
  for (int i = 0; i < 5; i++) {
    if (i == min) continue;
    sum += a[i] % 10 == 0 ? a[i] : a[i] / 10 + 10;
  }
  sum += a[min];
  cout << sum << endl;
  return 0;
}
