#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
void solve() {
  vector<int> v(5);
  int mi = 11;
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    (mi) = min((mi), (v[i] % 10));
    ;
    if (v[i] % 10 != 0) v[i] += 10 - v[i] % 10;
    ans += v[i];
  }
  if (mi != 0) ans -= 10 - mi;
  cout << ans;
}
int main() {
  int T = 1;
  for (int i = 0; i < T; i++) solve();
}
