#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  vector<ll> n(5);
  ll num = 1000;
  ll id;
  for (int i = 0; i < (int)(5); i++) {
    cin >> n.at(i);
    if (num > n.at(i) % 10 && n.at(i) % 10 != 0) {
      num = n.at(i) % 10;
      id = i;
    }
  }
  ll ans = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (i == id) continue;
    ans += 10 * (ceil((double)n.at(i) / 10.0));
  }
  ans += n.at(id);
  cout << ans << endl;
  return 0;
}
