#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
long long N, M, K, ans, A, B, a[5], b[5];
string s;
int main() {
  A = -1;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 > 0) {
      b[i] = a[i] + (10 - (a[i] % 10));
      A = max(A, 10 - (a[i] % 10));
    } else {
      b[i] = a[i];
    }
  }
  for (int i = 0; i < 5; i++) {
    ans += b[i];
  }
  cout << ans - A << endl;
  return 0;
}
