#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
long long my_gcd(long long x, long long y) {
  long long r;
  while (y != 0) {
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}
long long my_lcm(long long x, long long y) { return (x * y) / my_gcd(x, y); }
long long my_pow(long long x, long long y) {
  long long sum = 1;
  while (y > 0) {
    sum *= x;
    --y;
  }
  return sum;
}
int a[5];
int main() {
  for (int i = (int)0; i < (int)5; ++i) cin >> a[i];
  int min = 11, index = -1;
  for (int i = (int)0; i < (int)5; ++i) {
    if ((min > a[i] % 10) && (a[i] % 10 != 0)) {
      min = a[i] % 10;
      index = i;
    }
  }
  int sum = 0;
  for (int i = (int)0; i < (int)5; ++i) {
    if (i != index)
      sum += (a[i] + (10 - a[i] % 10));
    else
      sum += a[i];
  }
  cout << sum << endl;
  return 0;
}
