#include <bits/stdc++.h>
const int INF = (int)1e9 + 10;
const long long MOD = (long long)1e9 + 7;
const long long LINF = (long long)4e18 + 20;
const long double PI = acos(-1.0);
const double EPS = 1e-9;
using namespace ::std;
void chmax(long long& a, long long b) { a = max(a, b); }
void chmin(long long& a, long long b) { a = min(a, b); }
void solve() {
  vector<int> A(5);
  int time = 0;
  vector<int> B;
  for (int i = 0; i < 5; ++i) {
    cin >> A[i];
    if (A[i] % 10 == 0) {
      time += A[i];
    } else {
      B.push_back(A[i]);
    }
  }
  int N = B.size();
  vector<int> C;
  for (int i = 0; i < N; ++i) {
    int ter = B[i];
    time += (ter / 10) * 10;
    B[i] %= 10;
  }
  sort(B.begin(), B.end());
  time += 10 * (B.size() - 1);
  if (B.size()) {
    time += B[0];
  }
  cout << time << endl;
}
signed main(void) {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed;
  cout << setprecision(16);
  solve();
}
