#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> a(5);
  for (int i = 0; i < (5); ++i) {
    cin >> a[i];
  }
  int ans = 0, m = 10, m2, m3;
  for (int i = 0; i < (5); ++i) {
    if (a[i] % 10 == 0) {
      ans += a[i];
    } else {
      m2 = a[i] % 10;
      m = min(m, m2);
      ans += (a[i] / 10 + 1) * 10;
    }
  }
  if (m == 10) {
    cout << ans << endl;
  } else {
    ans += m - 10;
    cout << ans << endl;
  }
  return 0;
}
