#include <bits/stdc++.h>
using namespace std;
int x[7];
bool y[7];
int main() {
  int n = 5;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    if (x[i] % 10 == 0) {
      sum += x[i];
      y[i] = 1;
    }
  }
  int j;
  int MIN = 100000000;
  for (int i = 0; i < n; i++) {
    if (!y[i]) {
      if (x[i] % 10 < MIN) {
        MIN = x[i] % 10;
        j = i;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (i != j and !y[i]) {
      sum += x[i];
      sum += 10 - x[i] % 10;
    }
  }
  sum += x[j];
  cout << sum;
  return 0;
}
