#include <bits/stdc++.h>
using namespace std;
template <class T>
bool contain(const std::string &s, const T &v) {
  return s.find(v) != std::string::npos;
}
unsigned long long mod = 1e9 + 7;
int main() {
  int a[5] = {}, v2, v_min = 10, min_index = 0, sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    v2 = a[i] % 10;
    if (v2 != 0 && v2 <= 5) {
      v_min = v2;
      min_index = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      sum += a[i];
    } else if (i != min_index) {
      sum += a[i] + (10 - a[i] % 10);
    } else {
      sum += a[min_index];
    }
  }
  cout << sum << endl;
}
