#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  vector<int> x(5);
  for (ll i = 0; i < 5; i++) {
    cin >> x[i];
  }
  int max = 0, ans = 0;
  for (ll i = 0; i < 5; i++) {
    ans += ceil(x[i]);
    if (max < x[i] % 10) {
      max = x[i] % 10;
    }
  }
  cout << ans - max;
  return 0;
}
