#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[5];
  cin >> arr[0] >> arr[1] >> arr[2] >> arr[3] >> arr[4];
  int minmod = 9;
  for (int i = 0; i < 5; ++i) {
    if (((arr[i] - 1) % 10) < minmod) minmod = arr[i] % 10;
  }
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    sum += ((arr[i] - 1) / 10 + 1) * 10;
  }
  if (minmod != 9) {
    cout << sum - (10 - (minmod % 10)) << "\n";
  } else
    cout << sum << "\n";
  return 0;
}
