#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
int main() {
  vi X(5);
  for (int i = 0; i < (X.size()); i++) cin >> X.at(i);
  int min1 = 9;
  int imin;
  vi Y(5);
  for (int i = 0; i < (X.size()); i++) {
    if (X.at(i) % 10 != 0) {
      min1 = min(min1, X.at(i) % 10);
      imin = i;
    }
    Y.at(i) = ((X.at(i) + 10 - 1) / 10) * 10;
  }
  int ans = 0;
  for (int i = 0; i < (Y.size()); i++) {
    if (i == imin) continue;
    ans += Y.at(i);
  }
  ans += X.at(imin);
  cout << ans << endl;
}
