#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> a(5);
  for (long long i = 0; i < (long long)(5); i++) {
    cin >> a[i];
  }
  vector<long long> data(5);
  for (long long i = 0; i < (long long)(5); i++) {
    if (a[i] % 10 == 0) {
      data[i] = (a[i] / 10) * 10 - a[i];
    } else {
      data[i] = (a[i] / 10 + 1) * 10 - a[i];
    }
  }
  sort(data.begin(), data.end());
  long long ans = 0;
  ans += a[4];
  cout << ans << endl;
}
