#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dishes(5);
  for (int i = 0; i < 5; i++) {
    cin >> dishes.at(i);
  }
  vector<int> timeo(5);
  for (int i = 0; i < 5; i++) {
    timeo.at(i) = dishes.at(i) % 10;
  }
  vector<int> timeO(5);
  for (int i = 0; i < 5; i++) {
    timeO.at(i) = dishes.at(i) / 10 * 10 + 10;
  }
  int total = 0;
  for (int i = 0; i < 5; i++) {
    total += timeO.at(i);
  }
  int count = 0;
  for (int i = 0; i < 5; i++) {
    if (timeo.at(i) == 0) {
      count++;
    }
  }
  int A = 9;
  for (int i = 0; i < 5; i++) {
    if (timeo.at(i) != 0 && A > i) {
      A = timeo.at(i);
    }
  }
  count += 1;
  cout << total + A - count * 10;
}
