#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[10];
  int y = 9;
  for (int i = 0; i < 5; i++) {
    cin >> A[i];
    if (A[i] % 10 < y && A[i] % 10 != 0) {
      y = A[i] % 10;
    }
    if (A[i] % 10 != 0) {
      A[i] += 10 - (A[i] % 10);
    }
  }
  int res = 0;
  for (int i = 0; i < 5; i++) {
    res += A[i];
  }
  res = res - 10 + y;
  cout << res << "\n";
}
