#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const long long mod = 1000000007;
const double PI = acos(-1.0);
const int INF = 1e9 + 7;
int a, b, c, d, e;
int am, bm, cm, dm, em;
int l[5];
int one;
int maxi;
int tmp;
int total;
int mini = 10;
int plus;
int mini_id;
bool flag = false;
int main() {
  for (int i = (0); i < (5); ++i) {
    cin >> l[i];
  }
  for (int i = (0); i < (5); ++i) {
    one = (l[i] % 10);
    if (min(mini, one) != 0) {
      mini = min(mini, one);
      mini_id = i;
      flag = true;
    }
    total += l[i];
    tmp += 10 - one;
  }
  if (flag == false) {
    mini = one;
  }
  cout << total + tmp - (10 - mini) << endl;
}
