#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long push_back) {
  if (push_back == 0) return a;
  return gcd(push_back, a % push_back);
}
long long lcm(long long a, long long push_back) {
  return a / gcd(a, push_back) * push_back;
}
long long max(long long a, long long push_back) {
  if (a > push_back) return a;
  return push_back;
}
long long min(long long a, long long push_back) {
  if (a > push_back) return push_back;
  return a;
}
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void YN(bool push_back) { cout << (push_back ? "Yes" : "No") << endl; }
template <class T>
bool chmax(T &a, const T &push_back) {
  if (a < push_back) {
    a = push_back;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &push_back) {
  if (a > push_back) {
    a = push_back;
    return true;
  }
  return false;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<long long> a(5);
  for (long long i = 0; i < (5); ++i) cin >> a[i];
  long long res = accumulate(a.begin(), a.end(), 0);
  vector<long long> m(5);
  for (long long i = 0; i < (5); ++i) {
    m[i] = a[i] % 10;
  }
  sort(m.begin(), m.end());
  reverse(m.begin(), m.end());
  for (long long i = 0; i < (4); ++i) {
    if (m[i] == 0) continue;
    res += 10 - m[i];
  }
  cout << (res) << endl;
  return 0;
}
