#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmin(T &a, T b) {
  if (a >= b) a = b;
}
template <class T>
inline void chmax(T &a, T b) {
  if (a <= b) a = b;
}
const int INF = 1e9;
int a[5];
int main() {
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int rest = INF;
  int sum = 0;
  for (int i = 0; i < (5); ++i) {
    if (a[i] % 10 != 0) {
      chmin(rest, a[i] % 10);
      sum += a[i] + (10 - a[i] % 10);
    } else {
      sum += a[i];
    }
  }
  cout << sum - (10 - rest) << endl;
  return 0;
}
