#include <bits/stdc++.h>
namespace test {
std::string to_string(char val) { return std::string(1, val); }
}  // namespace test
using namespace std;
int main(void) {
  int *a = new int[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int result = 0;
  int minid = 0, min = 9;
  for (int i = 0; i < 5; i++) {
    if (min > (a[i] % 10) && (a[i] % 10) != 0) {
      min = a[i] % 10;
      minid = i;
      cout << minid << endl;
    }
  }
  swap(a[minid], a[4]);
  for (int i = 0; i < 4; i++) {
    if (a[i] % 10 != 0) {
      result += (a[i] / 10 + 1) * 10;
    } else {
      result += a[i];
    }
  }
  result += a[4];
  cout << result << endl;
  return 0;
}
