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