#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(5);
  vector<int> d(5);
  int m = 0;
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    d[i] = v[i] % 10;
  }
  sort(d.begin(), d.end());
  for (int i = 0; i < 5; i++) {
    if (d[i] == 0) continue;
    m = d[i];
    break;
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (v[i] % 10 != 0) ans += 10 - (v[i] % 10);
    ans += v[i];
  }
  cout << ans - abs(10 - m) << endl;
  return 0;
}
