#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a[5];
  vector<long long> b;
  long long sum = 0;
  for (int i = 0; i < (int)(5); i++) {
    cin >> a[i];
    sum += a[i];
    if (a[i] % 10 != 0) {
      sum += 10 - a[i] % 10;
      b.push_back(10 - a[i] % 10);
    }
  }
  sort((b.rbegin()), (b.rend()));
  sum -= b[0];
  cout << sum << "\n";
  return 0;
}
