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