#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[5];
  cin >> arr[0] >> arr[1] >> arr[2] >> arr[3] >> arr[4];
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    if (arr[i] % 10 == 0) {
      sum += arr[i];
    } else
      sum += arr[i] + (10 - arr[i] % 10);
  }
  int min = sum;
  for (int i = 0; i < 5; ++i) {
    if (sum - (arr[i] % 10) <= min) min = sum - (10 - arr[i] % 10);
  }
  cout << min << "\n";
  return 0;
}
