#include <bits/stdc++.h>
using namespace std;
bool exists(int a, int e, int k) {
  if (e - a > k) {
    return true;
  } else {
    return false;
  }
}
int main(int argc, char **argv) {
  int x[5];
  cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
  int min_rem = 9;
  int min_rem_idx = 0;
  for (int i = 0; i < 5; ++i) {
    if (x[i] % 10 != 0 && x[i] % 10 < min_rem) {
      min_rem = x[i] % 10;
      min_rem_idx = i;
    }
  }
  cout << "min_rem: " << min_rem << endl;
  cout << "min_rem_idx: " << min_rem_idx << endl;
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    if (i == min_rem_idx) {
      sum += x[i];
    } else if (x[i] % 10 != 0) {
      sum += x[i] + (10 - (x[i] % 10));
    } else {
      sum += x[i];
    }
  }
  cout << sum;
  return 0;
}
