#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
using ll = long long;
unsigned gcd(unsigned a, unsigned b) {
  if (a < b) return gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
int main() {
  vector<int> D(5);
  for (long long i = 0, i_len = (5); i < i_len; ++i) cin >> D[i];
  vector<int> MD(5);
  int ama = 0;
  int sum = 0;
  for (long long i = 0, i_len = (5); i < i_len; ++i) {
    MD[i] = (D[i] + 9) / 10 * 10;
    sum += MD[i];
    ama = max(ama, MD[i] - D[i]);
  }
  ama = 10 - ama;
  int ans = sum - ama;
  cout << ans << endl;
}
