#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
  vector<int> a(5);
  int ans = 0, mi = INF;
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
    ans += ((a[i]) / (10) + ((a[i]) % (10) == 0 ? 0 : 1)) * 10;
    if (a[i] % 10 != 0) mi = min(mi, a[i] % 10);
  }
  ans -= 10 - mi;
  cout << ans << "\n";
  return 0;
}
