#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(5);
  for (int i = 0; i < (5); ++i) cin >> A[i];
  int m = 10;
  int M;
  int ans = 0;
  for (int i = 0; i < (5); ++i) {
    if (A[i] % 10 == 0)
      ans += A[i];
    else if (A[i] % 10 < m) {
      ans += (M + 10 - m);
      m = A[i] % 10;
      M = A[i];
    } else {
      ans += A[i] + 10 - (A[i] % 10);
    }
  }
  ans += M;
  cout << ans << endl;
  return 0;
}
