#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A, B, C, D, E, a, b, c, d, e, pmax, ans;
  cin >> A >> B >> C >> D >> E;
  a = A % 10;
  b = B % 10;
  c = C % 10;
  d = D % 10;
  e = E % 10;
  pmax = 10;
  if (a != 0) {
    A = A + 10 - a;
    pmax = min(pmax, a);
  }
  if (b != 0) {
    B = B + 10 - b;
    pmax = min(pmax, b);
  }
  if (c != 0) {
    C = C + 10 - c;
    pmax = min(pmax, c);
  }
  if (d != 0) {
    D = D + 10 - d;
    pmax = min(pmax, d);
  }
  if (e != 0) {
    E = E + 10 - e;
    pmax = min(pmax, e);
  }
  if (pmax == 10) {
    pmax = 0;
  }
  ans = A + B + C + D + E + pmax - 10;
  cout << ans << endl;
  return 0;
}
