#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v1(5), v2(5);
  int ans = 0;
  for (size_t i = 0; i < v1.size(); i++) {
    cin >> v1[i];
    if (v1[i] % 10 == 0) {
      v2[i] = v1[i];
    } else {
      v2[i] = v1[i] - v1[i] % 10 + 10;
    }
  }
  int n_min = 9;
  for (size_t i = 0; i < v2.size(); i++) {
    if (v1[i] % 10 != 0 && n_min > v1[i] % 10) n_min = v1[i] % 10;
    ans += v2[i];
  }
  ans = ans - 10 + n_min;
  cout << ans << endl;
  return 0;
}
