#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    ans += (v[i] % 10 ? (v[i] / 10 + 1) * 10 : v[i]);
    v[i] %= 10;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < 5; i++) {
    if (v[i]) ans - (10 - v[i]);
    break;
  }
  cout << ans << endl;
  return 0;
}
