#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> d(5);
  vector<int> diff(5);
  for (int i = 0; i < 5; i++) {
    cin >> d[i];
    diff[i] = d[i] % 10;
  }
  int diffmin = 9;
  int diffi;
  for (int i = 0; i < 5; i++) {
    if (diffmin > diff[i]) {
      diffmin = diff[i];
      diffi = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (d[i] % 10 != 0 && i != diffi) {
      d[i] += (10 - (d[i] % 10));
    }
    ans += d[i];
  }
  cout << ans << endl;
}
