#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int A1, B1, C1, D1, E1;
  A1 = A % 10;
  B1 = B % 10;
  C1 = C % 10;
  D1 = D % 10;
  E1 = E % 10;
  int tmp = min({A1, B1, C1, D1, E1});
  int A2, B2, C2, D2, E2;
  A2 = (A + 9) / 10 * 10;
  B2 = (B + 9) / 10 * 10;
  C2 = (C + 9) / 10 * 10;
  D2 = (D + 9) / 10 * 10;
  E2 = (E + 9) / 10 * 10;
  int ans = A2 + B2 + C2 + D2 + E2;
  cout << ans - tmp << endl;
}
