#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5], max = 123, sum = 0;
  for (int i = 0; i < 5; i++) cin >> A[i];
  for (int i = 0; i < 5; i++) {
    if (max > A[i] % 10) max = i;
  }
  for (int i = 0; i < 5; i++) {
    if (i == max) continue;
    if (sum % 10 != 0) sum += (10 - sum % 10);
    sum += A[i];
  }
  if (sum % 10 != 0) sum += (10 - sum % 10);
  sum += A[max];
  cout << sum << endl;
}
