#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(5);
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < 5; i++) {
    if (A[i] % 10 == 0) {
      ans += A[i] / 10;
    } else {
      ans += A[i] / 10 + 1;
    }
  }
  int x = A[0];
  ans *= 10;
  for (int i = 0; i < 5; i++) {
    if (x % 10 > A[i] % 10 && A[i] % 10 != 0) x = A[i];
  }
  ans -= (x / 10 + 1) * 10;
  ans += x;
  cout << ans;
  return 0;
}
