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