#include <bits/stdc++.h>
using namespace std;
int A[5], min_v = 9, ans = 0;
void solve() {}
int main() {
  for (int i = 0, i_len = (5); i < i_len; ++i) {
    cin >> A[i];
    if (A[i] % 10 == 0)
      ans += A[i];
    else {
      ans += ((A[i] / 10) + 1) * 10;
      min_v = min(min_v, A[i] % 10);
    }
  }
  cout << ans - (10 - min_v) << endl;
}
