#include <bits/stdc++.h>
using namespace std;
int main() {
  int min = 99999, sum = 0, c;
  vector<int> a(5, 0);
  for (int i = 0; i < 5; i++) cin >> a[i];
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      continue;
    } else if (a[i] % 10 < min % 10) {
      min = a[i];
      c = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    int dig;
    if (i != c) {
      if (a[i] % 10 == 0) {
        sum += a[i];
      } else {
        sum += a[i] + (10 - a[i] % 10);
      }
    }
  }
  sum += min;
  cout << sum << endl;
  return 0;
}
