#include <bits/stdc++.h>
using namespace std;
int main() {
  int time = 0;
  vector<int> arr(5);
  vector<int> m10;
  for (int i = 0; i < 5; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < arr.size(); i++) {
    if (arr[i] % 10 == 0) {
      m10.push_back(arr[i]);
      arr.erase(arr.begin() + i);
    }
  }
  vector<int> mod10(arr.size());
  for (int i = 0; i < arr.size(); i++) {
    mod10[i] = arr[i] % 10;
  }
  int mini = *min_element(mod10.begin(), mod10.end());
  int temp;
  for (int i = 0; i < arr.size(); i++) {
    if (mod10[i] == mini) {
      temp = arr[i];
      arr.erase(arr.begin() + i);
      break;
    }
  }
  for (int i = 0; i < arr.size(); i++) {
    time += arr[i] / 10 * 10 + 10;
  }
  for (int i = 0; i < m10.size(); i++) {
    time += m10[i];
  }
  cout << time + temp;
  return 0;
}
