#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5];
  cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
  int mi = 9, sum = 0;
  for (int i = 0; i < 5; ++i) {
    mi = min(mi, (A[i] + 9) % 10 + 1);
    sum += (A[i] + 9) / 10 * 10;
  }
  cout << sum + mi - 10;
  return 0;
}
