#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 max = 0;
  int sum = 0;
  for (int i = 0; i < (5); ++i) {
    sum += a[i] / 10;
    if (a[i] % 10 != 0) {
      chmin(rest, a[i] % 10);
      ++max;
    }
  }
  cout << sum * 10 + (max - 1) * 10 + rest << endl;
  return 0;
}
