#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vec a(5);
  for (int i = 0; i < 5; i++) cin >> a[i];
  auto b = a;
  auto c = a;
  int mn = 9, mnn;
  for (int i = 0; i < (int)(5); i++) a[i] = a[i] % 10;
  for (int i = 0; i < (int)(5); i++) {
    if (a[i] % 10 != 0) b[i] += (10 - a[i]);
    if (min(mn, a[i]) != 0) mn = min(mn, a[i]);
  }
  int sum = 0;
  for (int i = 0; i < (int)(5); i++) sum += b[i];
  sum = sum - 10 + mn;
  cout << sum << endl;
}
