#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long N = 5;
  long long A[N];
  for (long long i = 0; i < N; ++i) cin >> A[i];
  long long gap[N];
  for (long long i = 0; i < (long long)(N); i++) gap[i] = (1000 - A[i]) % 10;
  sort(gap, gap + N);
  for (long long i = 0; i < (long long)(N); i++) A[i] = ((A[i]) / 10 + 1) * 10;
  long long ans = 0;
  for (long long i = 0; i < (long long)(N); i++) ans += A[i];
  ans -= gap[N - 1];
  cout << ans << endl;
}
