#include <bits/stdc++.h>
using namespace std;
int main() {
  int S[5], A[5], ans = 0;
  int Q = 1000000;
  cin >> S[0] >> S[1] >> S[2] >> S[3] >> S[4];
  if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3] && S[3] == S[4]) {
    if (S[0] % 10 == 0) {
      ans += 10;
    }
    ans += ((S[0] + 9) / 10) * 50;
    ans -= 10;
    ans += S[0] % 10;
    cout << ans << endl;
  } else {
    if (S[0] % 10 == 0 && S[1] % 10 == 0 && S[2] % 10 == 0 && S[3] % 10 == 0 &&
        S[4] % 10 == 0)
      ans += 10;
    for (int i = 0; i < 5; ++i) {
      A[i] = (S[i] + 9) / 10 * 10;
      ans += A[i];
      if (Q >= (S[i] % 10)) Q = S[i] % 10;
    }
    ans -= 10;
    ans += Q;
    cout << ans << endl;
  }
}
