#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long update_number(long long a) {
  if (a % 10 != 0) {
    a += 10 - a % 10;
  }
  return a;
}
int main() {
  vector<long long> input, first_num;
  long long tmp;
  for (int(i) = 0; (i) < (5); (i)++) {
    cin >> tmp;
    input.push_back(update_number(tmp));
    first_num.push_back(tmp % 10);
  }
  int min = 1e4;
  for (int(i) = 0; (i) < (5); (i)++) {
    if (first_num[i] != 0 && min > first_num[i]) min = first_num[i];
  }
  min = min != 0 ? 10 - min : 0;
  int ans = 0;
  for (int(i) = 0; (i) < (5); (i)++) ans += input[i];
  cout << (ans - min) << "\n";
  ;
  return 0;
}
