#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100], sum = 0, b[100], m = 9, p, n, j = 0;
  for (int i = 0; i < 5; i++) {
    cin >> n;
    a[i] = n / 10 * 10 + 10;
    if (n % 10 < m && n % 10 != 0) {
      m = n % 10;
      p = i;
    }
    if (n % 10 == 0) j++;
  }
  for (int i = 0; i < 5; i++) {
    if (i != p) sum += a[i];
  }
  sum += a[p];
  cout << sum - 10 + m - j * 10 << endl;
  return 0;
}
