#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  vector<double> vec;
  vec.push_back(A);
  vec.push_back(B);
  vec.push_back(C);
  vec.push_back(D);
  vec.push_back(E);
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    ans += ceil(vec[i] / 10) * 10;
  }
  int min = 10, sub = 0;
  for (int i = 0; i < 5; i++) {
    if (min > int(vec[i]) % 10 && int(vec[i]) % 10 != 0) {
      min = int(vec[i]) % 10;
      sub = vec[i];
    }
  }
  ans = ans - (10 - int(sub) % 10);
  cout << ans;
}
