#include <bits/stdc++.h>
using namespace std;
struct initon {
  initon() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  };
};
long long k = 0, n = 0, m = 9, l = 0, a = 0, b = 0, c = 0, d = 0, e = 0,
          ans = 0, ans2 = 0, x = 0, y = 0;
string s, t, S;
signed main() {
  vector<long long> A(5);
  for (long long i = 0; i < (long long)(5); i++) scanf("%lld", &A[i]);
  ;
  bool flag = false;
  for (long long i = 0; i < (long long)(5); i++) {
    if (A[i] % 10 < m % 10 && A[i] % 10 != 0) m = A[i];
  }
  for (long long i = 0; i < (long long)(5); i++) {
    if (A[i] != m || flag)
      while (A[i] % 10 != 0) {
        A[i]++;
      }
    else {
      flag = true;
    }
  }
  ans = accumulate(A.begin(), A.end(), 0);
  ;
  cout << ans;
}
