#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> food(5);
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> food[i];
    sum += food[i] + 10 - food[i] % 10;
  }
  int min = 10;
  for (int i = 0; i < 5; i++) {
    if (food[i] % 10 != 0) {
      if (min > food[i] % 10) {
        min = food[i] % 10;
      }
    }
  }
  cout << sum - 10 + min << endl;
}
