#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
int main() {
  vector<int> a(5);
  for (int i = 0; i < (int)(5); i++) cin >> a.at(i);
  int b = 9;
  for (int i = 0; i < (int)(5); i++) {
    if (a.at(i) % 10 > 0 && a.at(i) % 10 <= b % 10) {
      b = a.at(i);
    }
  }
  int Sum = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (a.at(i) % 10 > 0) {
      Sum += (a.at(i) / 10 + 1) * 10;
    } else
      Sum += a.at(i);
  }
  if (b % 10 > 0) {
    Sum -= (b / 10 + 1) * 10;
  } else {
    Sum -= b;
  }
  Sum += b;
  cout << Sum << endl;
}
