#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1LL << 60;
bool pairCompare(const pair<double, long long int>& firstElof,
                 const pair<double, long long int>& secondElof) {
  return firstElof.second < secondElof.second;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
long long int junnretu(long long int n) {
  long long int ans = 1;
  for (long long int i = 1; i <= n; i++) {
    ans *= i;
  }
  return ans;
}
int main() {
  long long int a[5], ans = 0, x = 9;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (long long int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      ans += a[i];
    } else {
      x = min(x, a[i] % 10);
      a[i] = a[i] / 10;
      ans += a[i] * 10 + 10;
    }
  }
  x = 10 - x;
  cout << ans - x << endl;
  return 0;
}
